java-equals和== 区别:
package com.etc.fangfa.equals;
/**
* equals() 方法: equals() 和 == 前者是内容相等,后者是同一个对象
*/
public class Equals {
public static void main(String[] args) {
Integer integer = new Integer(10);
Integer integer1 = new Integer(10);
if(integer.equals(integer1)){
System.out.println("想等");
}else {
System.out.println("不相等");
}
}
}