Here are a set of exercises that we suggest you do to become familiar
with reading and processing data in files. These mimic what we did in
lecture, but you will understand this much better if you do it for
yourself. The lecture files (posted on the Web) and the text are
excellent sources of information.
1. Read and echo the first few tokens of the names file:
Note the names and numbers
Try using next() and nextInt()
2. Use a while loop to read/echo the file:
Read/echo one line at a time use nextLine()
3. Use one Scanner to get the name of the file
from the user
Use a second Scanner to read/echo the file
as in #2
4. Use two Scanners to read/echo the file:
First to get lines from the file [nextLine()]
Second to get strings from the line [next()]
5. Refresh your memory about the Graphics panel:
Draw a graphics panel with the lines and
labels