String a = "A";
String b = "B";
String c = a + b;
String d = a + b;
System.out.println((a+b) == (a+b)); //returns false WHY??
Since string objects are immutable, whenever you use + operator on string, it will create a new string. So if you do (a+b) == (a+b), two new string object would be created and the reference would be different. so it will return false..
(a+b).toEquals(a+b) should return true since it's checking string contents.. though it will create two objects too, the contents would be same..