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
Interesantly unlike the Sting the StringBuffer does not override the equals() method. Its functionality is the same as for the Object class.
Sting
StringBuffer
equals()
Object