Here String str is static, then when will this object be stored in memory?
String is strnot an object; it is a reference to an object. "ABC", "XYZ"and "ABCXYZ"are three different String objects. Thus, strpoints to a string. You can change what it points to, but not what it points to.
Since String is immutable, where will the object for "XYZ" be stored?
, Mik378, "XYZ" - String, String, , "XYZ" .
?
"ABCXYZ" , , .
?
. Java 7, HotSpot JVM , permgen. Java JVM . , . -, permgen , permgen , JVM.
, , , String . , , , , .