why won't this work? i have a txt file that i need to read into a matrix. i want to read into a char array so i can analyze each char separate.
String fname = "c:\\game.txt";
char[][] matrix = new char[4][4];
private void readFile()
{
try
{
Scanner s = new Scanner(this.fname);
char next ;
for(int i = 0; i < matrix.length; i++)
{
for(int j =0; j < matrix.length; j++)
{
while(s.hasNext() == true)
{
this.matrix[i][j] = next;
}
}
}
}
catch(Exception e)
{
String s = e.toString();
System.out.println(s);
}
}