深入理解equals和==的区别:
代码如下:
public class IntegerTest { public static void main(String[] args) { Integer a = new Integer(1); Integer b = a; Integer c = new Integer(1); System.out.println(a==b); //true System.out.println(a==c); //false } }
时间: 2024-10-03 22:42:12