This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
StringBuffer class DOES NOT override the equals() method. Therefore, it uses Object class' equals(), which only checks for equality of the object references. StringBuffer.equals() does not return true even if the two StringBuffer objects have the same contents:
I am getting compiler error when i tried following, can any explain why its happening...
For future reference, you should start your own thread when asking a new question. Also, it is VERY helpful if you post the exact error message that you get. Otherwise, we are only guessing what the problem is. I don't know about others here at the Ranch, but Most of the time, I won't take the time to compile the code you post. (That's assuming that you provide enough code to compile.) So please post your error messages.