I have a fairly simple issue that’s been driving me crazy. Below is a method which is supposed to read an infile and store the data into a 2d array.
I keep getting compiler errors for the “inFile.next();” lines. Is there a special syntax to use with storing inFiles into arrays? Or is it something else?
Below is my method:
// reads and stores data in the array
public static void getData(double t[][],int m) {
Scanner keyboard = new Scanner(System.in);
for (int i = 0; i < m; i++) {
t[i][0] = inFile.next();
t[i][1] = inFile.next();
} // end for
} // end function getData
replace
inFile.next()withkeyboard.nextDouble()