K
KyoGaSuki
I was just trying out a simplified version of a reply from a previous
post, attempting to call a method...but it keeps coming up with the
error message "Cannot find symbol variable number". Can anyone help?
/**
* @(#)try2.java
*
* try2 application
*
* @author Kasumi
* @version 1.00 2008/4/3
* Attempting to finally and sucessfully CALL a method...and...I still
prove unsucessful...
*/
import java.util.*;
public class try2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println(getNumber(num)); // All I want it to do is to
print the number that I
// input from the method.
}
public static int getNumber(){
Scanner input = new Scanner(System.in); // It told me it couldn't
find the scanner, so
// I put it here and the error message went away.
System.out.print("Enter an integer: ");
int number = input.nextInt(); // Could this be the problem? I
don't know any other way to
// make the user input a variable, though.
return number; // ...please return?
}
}
------------ Build Report ------------
cannot find symbol variable num
post, attempting to call a method...but it keeps coming up with the
error message "Cannot find symbol variable number". Can anyone help?
/**
* @(#)try2.java
*
* try2 application
*
* @author Kasumi
* @version 1.00 2008/4/3
* Attempting to finally and sucessfully CALL a method...and...I still
prove unsucessful...
*/
import java.util.*;
public class try2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println(getNumber(num)); // All I want it to do is to
print the number that I
// input from the method.
}
public static int getNumber(){
Scanner input = new Scanner(System.in); // It told me it couldn't
find the scanner, so
// I put it here and the error message went away.
System.out.print("Enter an integer: ");
int number = input.nextInt(); // Could this be the problem? I
don't know any other way to
// make the user input a variable, though.
return number; // ...please return?
}
}
------------ Build Report ------------
cannot find symbol variable num