public class EqualTest { public static void main(String[] args) { int a = 10; int b = 10; double c = 10.0; System.out.println(a == b);//true System.out.println(a == c);//true boolean f = true; // System.out.println(a==f); char d = 10; System.out.println(a == d);//ture //引用数据类型 Customer c1 = new Customer(); Customer c2 = new Customer(); System.out.println(c1 == c2);//false String s1=new String("tom"); String s2=new String("tom"); System.out.println("***********************"); System.out.println(c1.equals(c2));//false System.out.println(s1.equals(s2));//true } } class Customer{ }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)