我正在使用Microsoft提供的Edx课程学习JAVA,我在重复他们视频中的示例,但每当我编译时,都会显示这个错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at var.main(var.java:3)以下是我的代码,它与视频教程中的代码基本相同:
public class var {
public static void main (String[] args) {
int x= 12;
System.out.println("my number is" + x);
}
}我用的是Eclipse IDE,而他们用的是IntelliJ,希望你能指出错误。谢谢。
发布于 2019-11-06 17:52:44
更改类的名称。由于Java版本10不允许使用var作为类型名称(JLS§3.8 TypeIdentifier Var就可以了。
https://stackoverflow.com/questions/58727057
复制相似问题