Countries.dat data file in the preceding example is a flat file—an ordinary text file with no special structure or formatting. It is the simplest kind of data file.
Another simple, common format for data files is the comma separated values (CSV) file. It is also a text file, but uses commas instead of blanks to separate the data values. Here is the same data as before, in CSV format:
In this example, we have added a header line that identifies the columns by name:
For Java to process this correctly, we must tell the
Scanner object to use the comma as a delimiter. This is done at ...