import java.io.*; import java.util.*; class TokiFile { public static void main (String[] args) throws Exception { // Array to hold a collection of passengers Passenger[] people = new Passenger[255]; int i = 0; // Make a connection to the data file "people.dat" FileReader fr = new FileReader("people.dat"); BufferedReader br = new BufferedReader(fr); // Read the first String from the file String inputString = br.readLine(); // while the end of the file has not been reached... while (inputString != null) { // Create a StringTokenizer for the current line StringTokenizer st = new StringTokenizer(inputString,"/"); // ...tokenize the current String String s1 = st.nextToken().trim(); String s2 = st.nextToken().trim(); String s3 = st.nextToken().trim(); // ...create a new Passenger object Passenger p = new Passenger(s1,s2,s3); // ...add the new passenger to the collection people[i] = p; // ...move to the next empty index position i++; // ...read the next line inputString = br.readLine(); } // end while } // end main } // end class