I’m not sure how to use
Scanner stdin = new Scanner(System.in); //Keyboard input
which I declare in main() in other methods of the class containg it. I get “stdin cannot be resolved”.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to learn about variable scope (and here’s a link to the Java Tutorial, and another on variable scope).
In order to use that variable in other methods, you need to pass a reference to your other methods.
Alternatively, you could declare the scanner as a static field: