public class MyString {
public static void main(java.lang.String[] args){
String a="Hello";
a=a.trim().concat("World");
String c="HelloWorld";
System.out.println(a==c);//returns false
}
interning should happen implicitly for string literals .Then why a and c are treated as two different strings? Will a and c point to same memory reference in string pool? Hash code returned by a and c are same but a==c returned false. Can someone explain on why the value returned is false.