+ 1
I donât understand what Scanner in = new means. Why is this?
I donât understand what Scanner in = new means. Why is this?
3 Answers
+ 5
It use to to get input from a person who are work with this program
+ 3
Scanner is a class which you import with import java.util.Scanner;
it is used to get user input.
Scanner sc = new Scanner(System.in);
this line of code generates a scanner object named "sc".
using this object you can now request input like this(, but there are many diffrent ways to get input using a Scanner):
String input = sc.next();
+ 1
Scanner can scan stream of some data, eg user input from keyboard