1String uses a special memory location
2to reuse of String objects called String Constant Pool.
3String objects created without
4the use of new keyword are stored in the
5String Constant Pool part of the heap.
6It doesn't create the same string object
7if there is already string constant in the pool.
8
9
10String str = new String("");
11String str2 = "";
12
13Str goes to heap memory
14str2 goes to string pool location
15
16They both immutable and they save in different
17memory location.