+ 2

How to create multiple scanner objects in java?

Related to java

1st Mar 2020, 11:56 AM
Kartikey Singh
Kartikey Singh - avatar
4 Answers
+ 3
You can create only one scanner object and use it any where else in this class.
12th Mar 2020, 2:31 AM
Ketul Patel
Ketul Patel - avatar
+ 1
Why you need multiple Scanner? You can do with only one..
1st Mar 2020, 12:20 PM
Jayakrishna 🇼🇳
+ 1
Thank you for telling me.
2nd Mar 2020, 9:28 AM
Kartikey Singh
Kartikey Singh - avatar
0
The same way you create any object in Java. Scanner scan1 = new Scanner(System.in); Scanner scan2 = new Scanner(System.in); File data = new File("data.txt); Scanner fileRead = new Scanner(data); And so on but I'm not sure why you'd need multiple Scanners
1st Mar 2020, 12:39 PM
HNNX 🐿
HNNX 🐿 - avatar