aspose file tools*
The moose likes Java in General and the fly likes equals method with stringbuffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "equals method with stringbuffer" Watch "equals method with stringbuffer" New topic
Author

equals method with stringbuffer

mukesh pandey
Greenhorn

Joined: Apr 02, 2010
Posts: 22
StringBuffer sb1 = new StringBuffer("Amit");
StringBuffer sb2 = new StringBuffer("Amit");

why

sb1.equals(sb2) = false ?

while

String s1 = new String("Amit");
String s2 = new String("Amit");

s1.equals(s2) = true
Vinoth Kumar Kannan
Ranch Hand

Joined: Aug 19, 2009
Posts: 276

A search in this forum would have helped. We had this topic discussed recently.
http://www.coderanch.com/t/496567/java/java/Difference-equals-method-string-stringbuffer
Please search before posting a question..


OCPJP 6
 
 
subject: equals method with stringbuffer