Figure 2


(a) Reading a line of text into a variable; (b) using the nextToken method to get the next field; (c) reading the data file as a DataInputStream.

(a)
DataInputStream superStore = new DataInputStream
(new FileInputStream("store.dat"));
...
String sProduct = superStore.readLine();

(b)
class Store {

public Store (String productFile) throws Exception {
     products_ = new Vector();

(c)
DataInputStream superStore = 
     new DataInputStream
                (new FileInputStream(productFile));