package Numberten;public class telephone extends Telephone_f{ public static void main(String[] args){ telephone t1 =new telephone(); telephone t2=new telephone(); t1.size=10; t1.cpu=11; t1.mem=12; t2.cpu=11; t2.size=10; t2.mem=12; if(t1.equals(t2)){ System.out.println("BINGO"); }else{ System.out.println("Crap"); } } }无法重写equals()方法 ,编译器报错:there are no non-static fields in this class.Cannot create equals() and hashCode() methods.但是我明明已经创建实例对象了。
添加回答
举报
0/150
提交
取消