Hi i am new to java programming,i created strings object as given below
String s1="mystring";//Address location is 1000
String s1=new String("mystring");//Address location is 1000
String s1=new String("yourstring");
String s2=new String("mystring");
as per my knowledge these string are stored in string constant pool for Case1 with specific memory locations,similarly in case2 objects are created in Heap memory.how does these memory will mange and freed if we assign same or different strings to String objects.