class Demo
{
private int num;
Demo(int num)
{
this.num=num;
}
public boolean equals(object obj)
{
if(!(obj instanceof Demo))
return false;
Demo d=(Demo)obj;
return this.num=d.num;
}
}
class Person
{
}
class ObjectDemo
{
public static void main(String[] args)
{
Demo d1=new Demo(4);
Demo d2=new Demo(6);
System.out.println(d1.equals(d2));
}
}
编译 出错 错误提醒 “紧当显式请求注释处理时 才接受类名称“objectDemo” ”什么意思?
|