From the java virtual machine spec:
String literals and, more generally, strings that are the values of constant expressions are "interned" so as to share unique instances, using the method String.intern.
"andrei" is a String literal and therefore "interned". Therefore both String s1and s2 refer to the same String object, an interned String with the content "andrei".
Therefore (s1 == s2) && (s1.equals(s2)) is true. String#toString() doesn't create a new String (like many other methods from String) but simple returns this. Therfore s2 == s3 is true.