Ask coding questions

← Back to all posts
Java: What am i doing that is preventing me using the code to check the user input against the list?
Dawson313 (0)

ArrayList List = new ArrayList();

Get User Input:
Scanner userInput = new Scanner(;
System.out.println("What do you want to do?");
String user_choice =;

Check Input Against List:
if (user_choice(List)); {

Coder100 (19274)

extra semi right here

Dawson313 (0)

i removed it and it gave me:
 javac -classpath .:/run_dir/junit-4.12.jar:target/dependency/* -d . error: cannot find symbol
String user_choice =;
symbol: variable scanner
location: class Main error: cannot find symbol
if (user_choice(List)) {
symbol: method user_choice(ArrayList)
location: class Main
Note: uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
compiler exit status 1


Coder100 (19274)

you defined your scanner class to be userInput?

please, read the errors lol

Dawson313 (0)

that wasn't what i intended, i meant to set the name of it to userInput, i wanted the input to be string and to be able to reference it as userInput, i'll mess around with [email protected]

Dawson313 (0)

ok i think i have no idea what im doing with this scanner any [email protected]