Object o1 = new Object(); Object o2 = new Object(); //o1=o2; System.out.println(o1.equals(o2));
It returns false. It can return true
false
true
equals for Object compares memory references. That is why it is false since they are different Objects equals for String is overridden to compare based on characters. You have 2 empty String objects that is why equals returns true.
equals
Object
String