Today suddenly received and this is what is true. The first step on a pile of str2 object abc01 The second step in the pool in a abc01 str2 constant The third step str1 reference constant pool abc01 The results should not be the heap pool of==false? ! Zha return is true,, Great god teach,
CodePudding user response:
Intern method of documentation has been explained very clearly, in the pool when there is no object, the object in the pool, and returns the object reference So Str2. Intern abc01 was put into the pool, and returns the str2 (reference) for str2 is abc01 So the second step is to understand a problem Pool into abc01, str2 is to point to in the pool abc01 object So str1 and str2 abc01 object in all point to the pool, so==is true