why does declaration of Sacnner ABC=new Scanner(); shows error in Java eclipse.? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why does declaration of Sacnner ABC=new Scanner(); shows error in Java eclipse.?

1st Aug 2016, 4:36 PM
Raj Paul
Raj Paul - avatar
2 Answers
+ 1
Pass in "System.in" Into the contructor of the class Scanner e.g Scanner s = new Scanner(System.in);
1st Aug 2016, 4:40 PM
Ousmane Diaw
0
you need an InputStream, a String, a File, a Readable, ... as an argument for the Scanner konstruktor. For example System.in. https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
1st Aug 2016, 4:58 PM
FreakManMega