StringBuffer does not override the equals() method and so inherits the one in the Object class. Have a look at the documentation for Object.equals() and the output will make sense. [ July 03, 2008: Message edited by: Joanne Neal ]
Also, the reason the first comparison (s1==s2) returns false is that the == operator will, when used on objects, check if s1 and s2 are the same object. That is, if they are really references to the same memory area. Had you written like this:
All three lines testobject equality, not string equality. That's why they're mutually not equal.
Note that StringBuffer does not override the equals method, and thus uses the one inherited from Object (which tests for object equality). The String class, on the other hand, overrides equals to test for string equality.
Something like "s1.toString().equals(s2.toString())" might give you the result you were expecting.
PS: Which, as I now see, is just about what Joanne and Carl said. Oh well. [ July 03, 2008: Message edited by: Ulf Dittmer ]