public static void main(String[] args) {
Integer[] q ={1,2,3,4,5};
List s = Arrays.asList(q);
for (Integer x : s) {
System.out.println(x);
}
}
你现在的s 是List类型的,直接用Integer肯定不行;
要么这样改:
for (Object x : s) {
System.out.println(x);
}
要么这样改:
List<Integer> s = Arrays.asList(q);