What is the difference between an addition of String Literal and String Object?
For example
String s1 =\"hello\"; String s2 =\"hello1\";
Because you're comparing references. To compare contents, use s1.equals(s2).
s1.equals(s2)
If your comparison of references is intentional, it is unclear why you're expecting the compiler/JVM to intern or not intern identical strings arising in different ways.