+ 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 ?
4 Answers
+ 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
0
Here what does sc mean ?
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/
0
Okay, understood.