Dora 发表于 2014-3-5 00:09
System.out.println(a==b);//false
System.out.println(b==c);//true
因为String在new的时候会在堆中申请新 ...
package com.itheima;
public class EasyTest7 {
public static void main(String[] ags){
Integer i=1;
int j=1;
Integer k=new Integer(1);
System.out.println(i==j);//true
System.out.println(k==j);//true
System.out.println(i==k);//false