摘要:
String, StringBuilder, StringBuffer通过一些例子说明String的运行机制,首先明确确定的字符串值会提前被放入1.最简单的常量赋值 public void test() { String test = "test"; }查看JVM字节码public void test(); Code: 0: ldc #2; //String test 2: astore_1 3: return解释:0: 从常量池获取常量#2(即"test")并将其压入栈顶2: 将栈顶字符串引用弹出并赋给本地变量 1 (即变量te... 阅读全文