String a=new String("amit");
String b="arit";
String c=a.replace('m','r');
System.out.println(b==c);
when c String is created replace() returns "arit" which allready exists in the memory pool referenced by b. so why doesnt c refer to b? instead it creats a new String which results b==c to false
Strings always check the memory pool if the new String already
exists in memory, so y doesnt c pick b from pool rather it creates a new string why does this happen
Thanks,
pallavi