String的 intern关键字
摘要:注解 : String a = new String("1"); a形参出现在栈上 , 同时堆上会出现一个a的地址值, 关键 1这个常量已经出现在常量池内了. 所以 a = a.intern() ; 无论用不用a来接收这个方法的返回值, a都指向常量池内的 1. String b = a + a ;
阅读全文
posted @ 2020-06-10 18:30
posted @ 2020-06-10 18:30
posted @ 2020-06-10 18:20