I guess you wanted something like this
public static void main(String[]args){
String[][]vehicles data = getVehiclesData();
}
public static String[][] getVehiclesData(){
// Open the file to read
File file = new File(filename);
Scanner input = new Scanner(file);
// create a Vehicle Records Array of
// Rows [Max Records] x Columns [12]
final int MAX = number++;
String[][] VehicleData = new String[MAX][12];
// read data from a file
while (input.hasNext() & (i <= MAX))
{
VehicleData[i][0] = input.next(); // Vehicle type
VehicleData[i][1] = input.next(); // Driver last name field
VehicleData[i][2] = input.next(); // Street address
VehicleData[i][3] = input.next(); // City
VehicleData[i][4] = input.next(); // State
VehicleData[i][5] = input.next(); // Zip Code
VehicleData[i][6] = input.next(); // Student ID
VehicleData[i][7] = input.next(); // Car Make
VehicleData[i][8] = input.next(); // Car Model
VehicleData[i][9] = input.next(); // Car Year
VehicleData[i][10] = input.next(); // Car VIN
VehicleData[i][11] = input.next(); // State of car registration
i++;
}
// Close the file
input.close();
return VehicleData;
} peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902