In Java 7 or below, if String is created using below syntax
String s1=new String("abc");
As per this link, Whenever we create a String Object, two objects will be created i.e. One in the Heap Area and One in the String constant pool and the String object reference always points to heap area object as shown below.
----------------------------------------------
| Heap | String Constant Pool |
|---------------------|-----------------------
| | |
| "abc" | "abc" |
| ^ | |
| | | |
| s1 | |
What will be the memory representation if we create another String object with the same value as
String s2=new String("abc");
And Will this create another object with same value in heap?
or it will just create object refering to String constant pool into heap ?