我需要比较列表中的值和数组中的值。 我写道:比较列表和数组
public class JavaApplication3 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic hereut
List<String> l = new ArrayList<String>();
l.add("test");
l.add("b");
String v = "";
String s = "";
String[] arr = {"test", "c", "b"};
for (int i = 0; i < l.size(); i++){
v = "";
s = "";
//System.out.println(l.get(i));
for (int j = 0; j < arr.length; j++){
if (l.get(i).equals(arr[j])){
s = i + "";
}else{
s = arr[i];
}
v = v + s + ",";
}
System.out.println(v);
}
}
}
我获得以下 0,测试,测试, C,C,1 但我需要这样的结果: 0,C,1 ,
嗨,我得到线(指针错误
coco
预计 不是一个声明 ';'预期 不兼容的类型 要求:发现布尔 :整数 – coco
如果'什么(;指针
Elbek