62,614
社区成员
发帖
与我相关
我的任务
分享
1. public static void main(String args[])
2. {
3. Integer i1=new Integer(13);
4. Integer i2=new Integer(13);
5. int i3=13;
6. System.out.println(i1==i2);
7. System.out.println(i2==i3);
8. System.out.println(i3==i1);
9. }
10. * Output
11. * true
12. * false
13. * true
14. */
public static void main(String args[]) {
Integer i1 = new Integer(123);
int i = 123;
Integer i2 = 123;
System.out.println(i == i1); //true
System.out.println(i == i2); //true
System.out.println(i1 == i2); //false
}
public class MyJava{
public static void main(String[] args){
make(3,3); //调用后打印结果为true
make(500,500); //调用后打印结果为false
make(3,new Integer(3)); //调用后打印结果为false
make(new Integer(3),new Integer(3)); //调用后打印结果为false
}
public static void make(Integer a,Integer b){
System.out.println(a==b);
}
}
public static void main(String args[]) {
Integer i1 = new Integer(1123);
int i = 1123;
Integer i2 = 1123;
System.out.println(i == i1); //true
System.out.println(i == i2); //true
System.out.println(i1 == i2); //false
}