== tests for reference equality.
.equals() tests for value equality.
I saw this post How do I compare strings in Java? . And I still don't get why you get false when you compare
// ... but they are not the same object
new String("test") == "test"
// --> false
or
String str1 = new String("JAVA");
String str2 = new String("JAVA");
System.out.println(str1==str2);
Does this happen because they have different name or what is the reason ?