Integer.parseInt错误

时间:2013-10-10 23:27:24

标签: java

我刚刚开始使用Java。我正在尝试编译这个程序

class poop{
  public static void main(String[] args){
    System.out.println(Integer.parseInt("1"));
  }
}

但是我收到了这个错误

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

怎么了?

我在Lubuntu上使用JDK 7

1 个答案:

答案 0 :(得分:9)

您已将您的java文件命名为Integer,但

  1. 这与文件(poop)和
  2. 中的类名不匹配
  3. 阴影java.lang.Integer
  4. 将文件命名为与其包含的顶级类相同,绝对不是 Integer

相关问题