I read that string constant pool is self referenced Also in this link it is written as the creation of String literal :
String s= "new";
will create a new String "new" in the heap if there is not one. So does it mean that object is always created in the heap regardless its literal or new object using new keyword?
What i understood of intern is -- it checks if there is a object in the heap with same name then it is referenced else new object is created in the heap. Please correct if i am wrong here.
Another doubt i have is - does the constant pool contains the objects or just the refernces to the objects in the heap.