简体   繁体   English

使用 jdk1.8 并收到奇怪的错误

[英]Using jdk1.8 and recieving weird error

I have this code: ArrayList<Integer> num_array = new Arraylist<Interger>();我有这个代码: ArrayList<Integer> num_array = new Arraylist<Interger>();

WHY am I getting this error: "Syntax error, parameterized types are only available if source level is 1.5 or greater"为什么我会收到此错误: "Syntax error, parameterized types are only available if source level is 1.5 or greater"

In your eclipse, go to the menu under Window -> Preferences -> Java -> Compiler .在您的 Eclipse 中,转到Window -> Preferences -> Java -> Compiler下的菜单。 That will allow you to change the java version with the "Compiler compliance level" setting, since it appears to be set to 1.4 or lower.这将允许您使用“编译器合规级别”设置更改 java 版本,因为它似乎设置为1.4或更低。

EDIT: Also, if that does not work, right click on the project in the Project Explorer to the left of the screen, choose Properties and select Java Compiler .编辑:另外,如果这不起作用,请右键单击屏幕左侧 Project Explorer 中的项目,选择 Properties 并选择Java Compiler Apply the same changes here as well.在此处也应用相同的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM