CodePudding user response:
Constant pool "ab", only "a" and "b"Create and you here refers to when creating? If refers to the time to create the code is executed, the only s3 (strictly speaking also created the StringBuilder), because the "a" and "b" in the class loading has been created and put into the constant pool, code just let the object of the reference variable constant pool, will not create objects,
These you can decompiling, look at pseudo code instructions
Javap -c - v yourclass. Class