views:

33

answers:

3

So I'm trying to take an input from a user using Scanner(System.in) but when i try to type something into the console it won't let me.

Can anyone help?

Function.show();

Scanner input = new Scanner(System.in);

if (input.equals("a"))
{
    Function.outputFile(1, list);
}

input.close();
A: 

do u put anything other than "a" as input? because if u do it won't work.

Also try to use "" in the input, like "Hey" and see if that will help you.

Good Luck!

Fredrick
The problem is that I can't type ANYTHING into the console, any key I press doesn't show up.
bananamana
+1  A: 

You're forgetting to call next on the Scanner. Your if line should be if (input.next().equals("a")), instead.

Yuliy
Oh my god I can't believe I didn't see that! Thanks!
bananamana