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.
Just go through the documentation of StringBuffer class. You will find that it doens't override the equals method. So the equals method of Object class is called which uses == for comparing the objects.
Now two StringBuffer objects don't refer to the same object even if they contain the same value. Each StringBuffer object created through the new syntax will always point to a different object. So using == on them will return false...
It would help greatly if you would also put in your post what the output IS, and what you EXPECTED it to be. That let's other focus in on what your misunderstanding is, rather than guess on what your confusion is.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors