https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.htmlhttps://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html
The Java programming language requires that identical string literals (that is, literals that contain the same sequence of code points) must refer to the same instance of class String (JLS §3.10.5).
https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.10.5
3.10.5. String Literals
Moreover, a string literal always refers to the same instance of class String. This is because 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.