String str1 = new String("I love programming");
String str2 = new String("I love programming");
boolean boo = str1 == str2; // evaluates to false
String str1 = "I love programming";
String str2 = "I love programming";
boolean boo = str1 == str2; // evaluates to true
Why does first one evaluate to false and second one evaluate to true?
And here you can find more: What is the Java string pool and how is "s" different from new String("s")?