public class Employee {
String name;
public Employee(String var){ this.name=var;}
}
public class Main {
public static void main(String[] args){
String s1=new String("joe");
String s2=new String("joe");
Employee e1=new Employee("joe");
Employee e2=new Employee("joe");
system.out.println("When comparing String obj:"+s1.equals(s2)); output:TRUE
system.out.println("When comparing Employee obj:+e1.equals(e2)): output:FALSE
I know we have to override Employee class but Why it is working for String class and I couldn't able to locate the equals override method in Oracle docs for String class also.Please need help !!