How can I override equals() method using inheritance?
<p>I have a subclass called "worker" extending the "Person" class. I am trying to override the equals() method from "Person" within the subclass of "Worker". Can anyone explain if my attempt is correct in terms of a basic override?</p>

<pre><code>public class Person {
    private String name;
    public Person(String n) {
        name = n;
    }
    public Person() {
        this("");
    }
    public String getName() {
        return name;
    }
    public String toString() {
        return getName() + " ";
    }
    public boolean equals(Object rhs) {
        if (!(rhs instanceof Person)) {
            return false;
        }
        Person other = (Person) rhs;
        return this.getName().equals(other.getName());
    }
    class Employee extends Person {
        double salary;
        public Employee(double b) {
            salary = b;
        }
        Employee() {
            salary = 150000;
        }
        public double getSalary() {
            return salary;
        }
        @Override
        public String toString() {
            return super.toString();
        }
        // my attempt
        @Override
        public boolean equals(Object rhs) {
            if (rhs == null) {
                return false;
            }
            if (getClass() != rhs.getClass()) {
                return false;
            }
            if (!super.equals(rhs))
                return false;
            else {
            }
            return false;
        }
    }
}
</code></pre>