1:
String s= "may";
2: String s1=new String("may");
3: if(s==s1)
System.out.println("==equal");
4: if(s.equals(s1))
System.out.println("equal");
why line 3 is not equal
am i not right,firstmay in places in the stringpool and then s is refereed to it
and then inline 2 it searches for the string "may"if its found it also refers tothe same object.
i know here one obj is places on the heap and otherin the string pool
wat i inferred was in line 1 reference is to the string obj in the pool and in line 2 reference is to the string object in the heap ,
Am i right,if not plz do explain.