+ 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..

4th Mar 2018, 7:59 PM
Rohini P S
Rohini P S - avatar
11 Antworten
+ 3
I have posted it
4th Mar 2018, 8:12 PM
Rohini P S
Rohini P S - avatar
+ 2
Tqsm maxcookmax... I got it...
5th Mar 2018, 3:07 AM
Rohini P S
Rohini P S - avatar
+ 1
put ur code in play ground and send it's link
4th Mar 2018, 8:51 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
you can not use scanner input since input is a variable name.you can use inp instead of input
10th Mar 2018, 1:52 AM
m yumbong
m yumbong - avatar
+ 1
Ok, I see what you're drivin at
10th Mar 2018, 3:23 AM
Nathan Lewis
Nathan Lewis - avatar
0
U will use this one.. Java.util.Scanner(System.in).nextInt();
5th Mar 2018, 9:25 AM
Madhusudhan
Madhusudhan - avatar
0
Which error did you get?
5th Mar 2018, 4:09 PM
PUNDLIK GOMARE
PUNDLIK GOMARE - avatar
0
also u can import java.util.*; or import java.util.scanner; then call it
10th Mar 2018, 1:54 AM
m yumbong
m yumbong - avatar
0
Can't use "input"? Works fine for me.
10th Mar 2018, 2:25 AM
Nathan Lewis
Nathan Lewis - avatar
0
well it works but it is advisable not to use data type to assign
10th Mar 2018, 2:28 AM
m yumbong
m yumbong - avatar
- 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"
5th Mar 2018, 10:59 PM
Nathan Lewis
Nathan Lewis - avatar