找不到整数parseInt方法

jam*_*Fog 2 java

我正在尝试这个代码,在其中测试一个简单的方法.您使用接收参数的方法.发生的问题是使用Integerparse int方法.

命令提示符给出错误.

java:24:error:cannot find symbol

cholo=Integer.parseInt("123");

             ^
symbol: method parseInt(String)

location: class Integer

1 error
Run Code Online (Sandbox Code Playgroud)

我不确定是什么原因造成的.

//Passing arguments in java

//this program demonstrates a method with a paramter

public class PassArg {
    public static void main(String[] args) {
        int x = 10;
        int k;
        int cholo;
        System.out.println(" I am passing values to displayValue ");


        displayValue(5);
        displayValue(x);
        displayValue(x * 4);
        k = 14;
        displayValue(14);
        cholo = Integer.parseInt("123");
        displayValue(cholo);
        System.out.println("now I am back in the main");
    }

    public static void displayValue(int num) {
        System.out.println("the value is " + num);
    }
}
Run Code Online (Sandbox Code Playgroud)

Ell*_*sch 5

我能想到的唯一解释是你有自己的Integer课程(而不是java.lang.Integer).重命名您的其他Integer类,或使用完整的限定类名称

int cholo = java.lang.Integer.parseInt("123");
System.out.println(cholo);
Run Code Online (Sandbox Code Playgroud)

输出是

123
Run Code Online (Sandbox Code Playgroud)