I understand the difference between string created using new String(param) and using literal.
When String created using litleral like -
String str = "param";
String str1 = new String("param");
It will create an object in Heap with "param" as value and str1 will contain reference to the object in heap.
str1 point to String objects in the Heap.
str is also in the String literal pool. All String objects in the String literal pool are on the heap from Oracle Java 6+
So the object created in heap actually contain the value "param" or contain reference from the string pool?
String contains a
char which will have the characters "param" and this will be the same reference to a
char as in the String literal pool (implementation dependant)