Originally posted by KN:
Hi!
Sorry for that incomplete message!
Can anybody please help me with this topic. This code returns false but I don't understand why?
StringBuffer sb1 = new StringBuffer("abc");
StringBuffer sb2 = new StringBuffer("abc");
System.out.println(sb1.equals(sb2));
Is there any example, in which equals() method in case of StringBuffer returns true.
Thanks in advance,
KN
StringBuffer sb1 = new StringBuffer("abc");
StringBuffer sb2 = sb1;
System.out.println(sb1.equals(sb2));
StringBuffer doesn't override equals() in Object, so it only
test to see if the references refer to the same object.