public class A { static String s1 = \"I am A\"; public static void main(String[] args) { String s2 = \"I am A\"; System.out.println(s1 == s
Because the Java Language Specification says:
String literals-or, more generally, strings that are the values of constant expressions (§15.28)-are "interned" so as to share unique instances, using the method String.intern.