String s = new String ( "xyz"); created several String Object What is the difference between the two??

After the end of this code executes, creating two or a "xyz".
The implementation process it will go there looking for a string constant pool "xyz", if there is, according to xyz production in the heap create a pool xyz objects, otherwise he would put xyz added to the character constant pool, and then go to the heap to create the object xyz. Difference is the difference between the two in which the storage space, resulting in management in different ways.

Guess you like

Origin www.cnblogs.com/remta/p/12122297.html