You need to know a few things to understand this:
1) The == operator asks if two variables refer to the same object -- i.e., they point to the same physical block of memory in the computer.
2) The equals() method, on the other hand, asks if two objects are "the same" in some way that makes sense for a particular class. For String, it means the two Strings contain the same characters in the same order.
3) Finally (and this is slightly oversimplifying, but indulge me, Tony) all identical
String literals (Strings that appear in a program between double quotes) refer to the same String object; in other words, if the sequence "abc" appears three times in a program, then all three copies refer to the same physical String object in the computer's memory.
SO now we can look at your program and understand the output. s1 and s2 refer to the same String object, so "==" says true; s3 is another object altogether, since you created it with "new". It contains the same characters, in the same order, but it's a different chunk of memory.
Now, if you replace "==" with equals() -- i.e., if (s1.equals(3)) -- then all the answers would be true, since all the Strings have the same characters in the same order.
THe moral of this story is that you should never use == to compare Strings: always use the equals() function. As a general rule, you should use the equals() function to compare objects unless you have some specific reason to use ==; some specific reason why you're
testing if two things are the same object, rather than just whether they're alike.