Write your code, compile it, then use "javap" with command "-c" to disassemble your java bytecode. You will see what java do with your String objects and how many are created.
Example:
javap -cp c:\myjava\stringtest\ StringTest
where c:\myjava\stringtest\ is classpath location, and StringTest is class name.