myFile = new Scanner(new FileInputStream(f));
int i = 0; //this will be our local array index
System.out.println("\nCreating a temporary array from file " + f.getName() + " with " + n + " records.");
while (myFile.hasNextLine()) { //to check for EOF
//fill up our array
a[i] = new Warship(myFile.nextLong(), myFile.next(), myFile.nextInt(),
myFile.next(), myFile.nextDouble(), myFile.nextInt());
i++; //increment the index
}
} catch (FileNotFoundException e) {
System.out.println("There was an error creating the Scanner object from file " + f.getName());