class Demo
{
private int[] arr;
Demo(int[] arr)
{
this.arr=arr;
}
public boolean equals(Object obj)
{
Demo d=(Demo)obj;
return Arrays.equals(this.arr,d.arr);
}
}
class ArrEquals
{
public static void main(String[] args)
{ int arr1[]={1,2,3};
int arr2[]={1,2,3};
Demo p1=new Demo(arr1);
Demo p2=new Demo(arr2);
System.out.println(p1.equals(p2));
}
我这样写的 但是显示Arrays在类中找不到
}
|