- 1
Can help me with the class Scanner?
How do it use the class Scanner in java
3 Answers
+ 4
Scanner var = new Scanner (System.in);
If you want to read in an input, for example, you want the user to enter an integer (non-decimal number), you need to call:
Int num = var.nextInt();
Or if you want to read in a String;
String str = var.nextLine()
https://code.sololearn.com/c4yofH1Bpxy1/?ref=app
+ 2
https://www.w3schools.com/java/java_user_input.asp
0
Thank you