import java.awt.List;import java.util.ArrayList;import java.util.Arrays;public class WwArrays {public static void main(String[] args) {int[] e = {1,2,22,32,12,325,323,42};List list = new ArrayList();list = Arrays.asList(e);System.out.println(List.get
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 16:46:57
import java.awt.List;import java.util.ArrayList;import java.util.Arrays;public class WwArrays {public static void main(String[] args) {int[] e = {1,2,22,32,12,325,323,42};List list = new ArrayList();list = Arrays.asList(e);System.out.println(List.get
import java.awt.List;
import java.util.ArrayList;
import java.util.Arrays;
public class WwArrays {
public static void main(String[] args) {
int[] e = {1,2,22,32,12,325,323,42};
List list = new ArrayList();
list = Arrays.asList(e);
System.out.println(List.get(0)[1]);
}
报了一个异常:请各位大虾帮我看看问题出在哪?
Exception in thread "main" java.lang.Error:Unresolved compilation problems:
The type List is not generic; it cannot be parameterized with arguments
The method get(int) is undefined for the type List
点击左边的小问号说:
the type List is not generic ,it can not be parameterized with argments int[].
import java.awt.List;import java.util.ArrayList;import java.util.Arrays;public class WwArrays {public static void main(String[] args) {int[] e = {1,2,22,32,12,325,323,42};List list = new ArrayList();list = Arrays.asList(e);System.out.println(List.get
抱歉,问题不是因为这个,你的代码问题如下:
1.你的List引用错了import java.awt.List;,不应该是这个,应该是java.util.List;
2.System.out.println(List.get(0)[1]);里的List应该是list对象,你写错了
3.最后你还少了一个}
:)
另外,List,Map,Set里建议使用Integer之类的对象,而不要用int,好像jdk1.5以后增加了可以使用int之类的.嘿嘿.