This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In case of �==�object reference are compared. Hence it returns false since sb1 and sb2 are in two different location. Since equals method is not overridden in StringBuffer class. Default implementation from Object class is present in StringBuffer. The default implemation is again check for object reference, not the object value. Hence since sb1 and sb2 are referring different memory location in the second case also it is returns false.
Sharing is learning
Joined: Jan 09, 2003
Hi Arun, How should I compare 2 StringBuffer values for equality