Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试创建一个整数类型的 ArrayList,但它给了我这个错误(我正在使用这个名为 jikes 的编译器)代码:
ArrayList<Integer> = new ArrayList<Integer>();
错误:
***语义错误:使用类型参数访问泛型类型需要使用“-source 1.5”或更高版本。编译将继续使用原始类型“Java.util.arraylist”,但不会发出类文件。
您的数组列表没有名称:
ArrayList<Integer> name = new ArrayList<>();
尝试以下:
List<Integer> list = new ArrayList<Integer>();
正确的初始化应该是
ArrayList<Integer> X = new ArrayList<Integer>();
你需要分配变量