Character change can be shared, then how to use it to share
three ways to create a string. Is then compared three separate
address and not the same 1,2 3
in stack inside a space called a string constant pool, from jdk1.7 start. String constant pool in the heap
objects string constant pool, in fact, is the preservation of the value of byte address of the byte array of
string 2 is also equal to abc, the constant pool has existed abc, so it will not again in the reconstruction. It will create a good address before reuse.
str1 str2 are reused and the same string
third string
char array is converted into a byte array
Phase 1 Language Basics + Advanced _1-3-Java language senior _1- common API_1_ Section 5 String class _3_ string constant pool
Guess you like
Origin www.cnblogs.com/wangjunwei/p/11206462.html
Recommended
Ranking