Hello everyone
I am using
string and I know that we can create string objects by two different ways:
1) String s="Hello"; //Line1
2) String s1= new String("Hello"); //Line2
so if we are using the code written in Line1 that means we are creating a String object in the String literal pool
and
the Line2 will create an String object in Heap
So what is String literal pool ?
Is it like heap or it is a table where we can store actual objects reference.
and
when will garbage collect remove the String objects from the heap
Thanks