我刚刚开始使用Java.我正在尝试编译这个程序
class poop{
public static void main(String[] args){
System.out.println(Integer.parseInt("1"));
}
}
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误
poop.java:3: error: cannot find symbol
System.out.println(Integer.parseInt("1"));
^
symbol: method parseInt(String)
location: class Integer
./Integer.java:5: error: cannot find symbol
Int a=5;
^
symbol: class Int
location: class Integer
2 errors
Run Code Online (Sandbox Code Playgroud)
这是怎么回事?
我在Lubuntu上使用JDK 7
你已经命名了你的java文件Integer,但是
poop)中的类名不匹配java.lang.Integer.将文件命名为它包含的顶级类,但绝对不是 Integer.