Does Java new String () create a corresponding string constant in the string constant pool?

String str = new String("abc");

create a string in this way. Is there "abc" in the string constant pool?

Mar.28,2021

there will be "abc" in the constant pool, which can be disassembled. Create "abc" in the constant pool and new a String ("abc") in the heap. The str, will be saved in the stack and the address in the heap will be assigned to str


.

if abc, already exists in String str=new String ("abc"); the constant pool can be directly referenced using the ldc directive, if not created. To view constant pools, you can use the javap-v command

jclasslib

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e774d6-649.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e774d6-649.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?