日期:2014-05-20 浏览次数:20737 次
import java.util.*;
public class Test2
{
public static void main(String[] args)
{
int []a = {1, 2, 3};
int []b = {1, 2, 3};
Boolean x;
x = equals(int[]a, int[]b);//书上写的是static Boolean equals(type[]a, type[]b),
//我的写法应该也没错呀?为什么得不到正确的结果
System.out.println(x);
String n = "abc";
String m = "opq";
Boolean y;
y = n.equals(m);
System.out.println(y);
}
}
public boolean equals(Object anObject)
public booleanequals(Object obj1,Objectobj2)
public boolean equals(Object obj1,Object obj2)
import java.util.*;
public class Test2
{
public static void main(String[] args)
{
int []a = {1, 2, 3};
int []b = {1, 2, 3};
Boolean x;
x = Arrays.equals(a,b); //数组的比较
System.out.println(x);
String n = "abc";
String m = "opq";
Boolean y;
y = n.equals(m);
System.out.println(y);
}
}