UPDATED
I am trying to read in a file(which was in the wrong place before) and store the contents into an array.Nothing outputs for some reason. Im new to exceptions btw.
I am trying to read in a file(which was in the wrong place before) and store the contents into an array.Nothing outputs for some reason. Im new to exceptions btw.
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class AssignmentFive
{
public static void main (String[]args)
{
int numOfRows=30;
int numOfColumns=6;
int[][] array= new int[numOfRows][numOfColumns];//30 rows 6 columns
int row, col;
int integerEquivalence;
String line;
FileReader fin;
try {
fin = new FileReader("homework_scores.txt");
BufferedReader buff = new BufferedReader(fin);
for(row=0;row<array.length;row++)
{
line=buff.readLine();
integerEquivalence=Integer.parseInt(line);
for(col=0;col<array[row].length;col++)
System.out.print(integerEquivalence);
}//end outer for loop
for(row=0;row < array.length; row++)
{
System.out.print("Student #"+(row+1)+":\t");
for(col=0;col<array[row].length;col++)
{
System.out.print(array[row][col]+" ");
}
System.out.println();
}
}catch (IOException e) {}
}//End Main
}//end AssignmentFive
Last edited: