如果你是要从一个string[]中找到某个string, 可以先把string[]转化为arrayList,然后用indexof方法,但是这个方法判断的实质还是equalspublic int indexOf(Object elem) Searches for the first occurence of the given argument, testing for equality using the equals method.
String s = new String();//参数自己填写 String[] array = new String[];//比较 s.equals(new String(array))
只有把String[]数组中的内容取出来,存成String字符串以后,才能比较吗?
楼主要比较的是String和String[]的一个元素还是什么?
可以先把string[]转化为arrayList,然后用indexof方法,但是这个方法判断的实质还是equalspublic int indexOf(Object elem)
Searches for the first occurence of the given argument, testing for equality using the equals method.
String[] array = new String[];//比较
s.equals(new String(array))