The Scanner class is a class used for "scanning" primitive types and
Strings. It can be used to get input from an InputStream, to parse through
a String of text or to read from a file.
Parsing Through a String
The constructor that we will be using from the Scanner class is:
Constructor Description
Scanner(String source) // Constructs a new Scanner that produces values scanned from the specified String.
The methods that we will be using from the Scanner class are:
nextInt() //Scans the next token of the input as an int.
hasNextInt() //Returns true if the next token in this scanner's input can be
interpreted as an int value in the default radix using the
nextInt() method.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment