Hi,
Can i know the reason for the
String literal assignment .
String str1 = new String("abc");
String str="abc";
System.out.println(str==str1);
System.out.println("Str memory-->"+str.hashCode());
System.out.println("Str1 memeory-->"+str1.hashCode());
output:
false
Str memory-->96354
Str1 memeory-->96354
Even though a new String object is created both of them have same address still str1=str gives false.
This is confusing .