我的答案是赋值相同的情况下phone1跟phone2是不同的,有错吗?
package PHONE; public class test { public static void main(String[] args) { Phone phone=new Phone(); Phone phone2=new Phone(); phone.cpu=2; phone.ram=3; phone.screen=4; phone2.cpu=2; phone2.ram=3; phone2.screen=4; if(phone.equals(phone2)){ System.out.println("phone等于phone2"); } else{ System.out.println("phone不等于phone2"); } } }
输入结果是不同的。这是老师想要的正确答案吗?