我的問題是如果實習生正在使用字符串和字符串有一個 SPC(字符串池常量)它和實習生的概念也使用整數, 所以有沒有任何整數池常量?它的工作如何?關於java中的實習生
class InternExample
{
public void print()
{
Integer i=10;
Integer j=10;
String c="a";
String s="a";
System.out.println(i==j);// prints true
System.out.println(c==s);//prints true
}
public static void main(String args[])
{
new InternExample().print();
}
}
閱讀本http://www.devx.com/tips/Tip/42276整數 – PeterMmm 2011-06-01 09:50:29
鬆散的聯繫:這裏是一個討厭的攻擊在Java中自動裝箱的,研究它可以幫助你理解的自動裝箱更好:http://thedailywtf.com/Articles/Disgruntled-Bomb-Java-Edition.aspx – Bolo 2011-06-01 10:19:39