0

Purpose of a here?

Int x; Scanner a= new Scanner (System.in); x= a.nextInt();

8th Jul 2019, 6:22 PM
Kinkar Maity
Kinkar Maity - avatar
2 Answers
+ 12
you can take multiple inputs using single Scanner object a, no need of making more objects of Scanner class, like this : int x=a.nextInt(); //i small in int int y=a.nextInt(); String str=a.next();
8th Jul 2019, 7:01 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
It's initializing a Scanner object called a ( could be called also with another name), showing that we're going to read user input. You can read about this here:https://www.sololearn.com/learn/Java/2220/
8th Jul 2019, 6:34 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar