Author: zfive5 (zhaozidong) email: zfive5@yahoo.com.cn
New Year's Day, friends asked me that XXX operation generated a few String objects - it also often in the Java interview question, I at the time I used the Java anti-compilation tool against a Class code to let him see, it is true that everything is! (Note: The following is the code that I have rewritten afterwards)
Java:
Package ZF5;
PUBLIC CLASS ZF5 {
Public zf5 () {}
Public static void main (string args []) {zf5 zf51 = new zf5 (); string a = "zfive5"; string a1 = new string ("Hello Zfive5"); string a2 = a; long A3 = 5L; Long A4 = New long (1L);}}
BYTECODE:
Package ZF5;
PUBLIC CLASS ZF5 {
Public zf5 () {// 0 0: ALOAD_0 // 1 1: InvokeSpecial # 1