+ 1

Can I have multiple inputs of user in java ?

How can I take different multiple inputs by user in a java code for the variables ?

1st Feb 2020, 11:43 AM
Meetesh
Meetesh - avatar
4 odpowiedzi
+ 3
By using the the Scanner class object for different variables. Scanner sc = new Scanner(System.in); int a = sc.nextInt(); String str = sc.next(); ...etc
1st Feb 2020, 12:00 PM
Avinesh
Avinesh - avatar
0
Here what does sc mean ?
1st Feb 2020, 2:07 PM
Meetesh
Meetesh - avatar
0
It could be any name. It's an instance of Scanner class. This is there in the course- https://www.sololearn.com/learn/Java/2220/
1st Feb 2020, 2:14 PM
Avinesh
Avinesh - avatar
0
Okay, understood.
1st Feb 2020, 2:34 PM
Meetesh
Meetesh - avatar