In java when you create objects with new keyword they are created in heap at some location .
Even if you create third reference variable str3 with new then also it will give you false if compare reference with str2
String str1 = "Hi there";
String str2 = new String("Hi there");
String str3 = new String("Hi there");
str2==str3 gives you false
So when you compare the values of objects use equals rather than reference .