When we create a string using new operator, we place the string in double quotes inside the constructor.. Eg.
String s=new String("literal");
Does JVM creates a new string object for "literal" and pass it to the constructor? i.e, are two objects created one of which is garbage collected. Or, only one object is created which is referenced by s.
The question popped because of the following statement: Jvm creates object for "every double quoted" values in the program.