+ 3
Why can't I use scanner class for giving input for a Java program... I'm getting error. Can any1 Pls help me out..
Pls answer me why can't I use scanner and suggest me how can I give input..
11 Answers
+ 3
I have posted it
+ 2
Tqsm maxcookmax... I got it...
+ 1
put ur code in play ground and send it's link
+ 1
you can not use scanner input since input is a variable name.you can use inp instead of input
+ 1
Ok, I see what you're drivin at
0
U will use this one..
Java.util.Scanner(System.in).nextInt();
0
Which error did you get?
0
also u can import java.util.*; or import java.util.scanner; then call it
0
Can't use "input"? Works fine for me.
0
well it works but it is advisable not to use data type to assign
- 1
at the top, outside of any classes, place
import java.util.Scanner;
then wherever you want to call it
Scanner input = new Scanner(System.in);
you dont have to call it "input"