I am trying to this code in which test out a simple method. In which you use a method which receives argument. The problem that is happening is with Integer parse int method.
The command prompt gives an error which is.
java:24:error:cannot find symbol
cholo=Integer.parseInt("123");
^
symbol: method parseInt(String)
location: class Integer
1 error
I am not sure what is causing this.
//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);
}
}
Integersince it is injava.langwhich is implicitly imported. Maybe he has his ownIntegerclass?Integerclass available at your class path... please confirm, that there is nothing else next to yourPassArg.javafile (namely noInteger.javamess).