String a = "Java";
String b = "Java";
System.out.println(a == b);  // True
// When you declare string like this, you are actually calling intern() method on String. 
// This method references internal pool of string objects.
// If there already exists a string value “Java”, 
// then str will reference of that string and no new String object will be created

String c = new String("Java");
String d = new String("Java");
System.out.println(c == d);  // False

Similiar Collections