nextInt() method of a
Scanner object reads in a string of digits
and converts them into an
Scanner object reads the characters one by one
until it has collected
those that are used for one integer.
Then it converts them into a 32-bit numeric value.
Usually that value is stored in an
The picture shows a program that reads in character data and then
converts it to an integer which is stored in
Next the program does arithmetic with
stores the result in
Finally the result is sent to
println which converts the numeric result
into characters and prints them out.
nextInt() method scans through the
input stream character by character, gathering characters
into groups that can be converted into numeric data.
It ignores any spaces and end-of-lines that may separate
Can arithmetic be done with strings of characters?