suppose we have a class Employee with the following data field and function. The program attempts to see if 2 Employees are equal by comparing their name and address
public class Employee{
private String name;
private double hours;
private double rate;
private Address address;
@Override
public boolean equals(Object obj){
if(obj == this) return true;
if(obj == null) return false;
if(this.getClass() == obj.getClass()){
Employee other = (Employee) obj;
return name.equals(other.name) && address.equals(other.address);
}else{
return false;
}
}
why didn't we do this instead public boolean equals(Employee obj) (different parameters)?