http://www.cnblogs.com/bitfan/archive/2010/10/24/1859687.html
1 奇特的程序输出
前段时间,一个学生给我看了一段“非常诡异”的Java代码:
public class TestInteger {
public static void main(String[] args){
Integer v1=100;
Integer v2=100;
System.out.println(v1==v2); //输出:true
Integer w1=200;
Integer w2=200;
System.out.println(w1==w2); //输出:false
}
}
public static void main(String[] args){
Integer v1=100;
Integer v2=100;
System.out.println(v1==v2); //输出:true
Integer w1=200;
Integer w2=200;
System.out.println(w1==w2); //输出:false
}
}
浙公网安备 33010602011771号