// Perform non-critical write operation where synchroniza-
tion is not necessary.
// Do other work.
// Close file, emptying output buffers to disk.
RandomAccessFile isusefulforcreatinga flat file database ,asinglefileorgan-
ized into records and fields. A record stores a single entry (e.g., a part in a parts data-
base) and a field stores a single attribute of the entry (e.g., a part number).
illustrates this concept in the context of a parts database.
Figure 8-1. This flat file database describes automotive parts.
Accordingto Figure8-1 ,eachfieldhasaname(partnum,desc,qty,anducost).Also,
which only three are shown for brevity.
Note The term field is also used to refer to a variable declared within a class. To
avoid confusion with this overloaded terminology, think of a field variable as being
analogous to a record's field attribute.
To show you how to implement a flat file database in terms of RandomAc-