I really don't like Java, but you're using == wrong. == compares reference equality, so for two objects it only compares their references (like pointer addresses in C/C++). You're supposed to use .equals for objects (those that implement it, that is), and if you change it to .equals then it works like expected (for both conditionals).
If you know that and are complaining about syntax then I guess that's valid (Java has atrocious syntax), but then you're left with === like in javascript or php which is worse imo.
The == operator should be overloaded for the String type, because:
1) While strings are reference types, they're immutable, so it's unlikely I'll need to test against another object for changes;
2) MMC: Massive Method Chaining. I can't do:[quote]if(new String(buff) == "Hello")[/quote]It has to be:[quote]if(new String(buff).equals("Hello"))[/quote]Which IMO is far less readable.
3) You can define string literals but not compare them intuitively, unlike literal ints;
4) Needing to use .equals is counter-intuitive compared to the rest of the programming world;
5) It is far less likely you would need to test whether two string identifiers point to the same object than comparing the value of a string object to that of another (where C# has the upper-hand).
I agree that it's less readable, and that "massive" method chaining in general looks bad. Unfortunately, overloading operators or making exceptions is not The Java Way, so we're stuck with preset operators for primitives and having to write methods for classes. Just today I overloaded comparisons in C++, and it's nice to have. For other languages like Ruby where you can't overload operators (+,*, etc. are actually methods), it's generally not a problem because the syntax is clean and the versatility is there to get around it. In Java you're stuck with, as you pointed out, foo.bar.blah...
I've said this before, but Java awkwardly forces you to use OO, and it's not even a very good at OO. Ruby, Python, probably C#, etc. are all better.