what is wrong with this code. it does not read the input file correctly.
private void readFile()
{
String fName = "c:\\game.txt";
ArrayList<ArrayList<String>> matrix = new ArrayList<ArrayList<String>>();
{
try
{
File file = new File(fName);
Scanner in = new Scanner(file);
// for ( int i = 0; i < matrix.size(); i++ )
// matrix.add(new ArrayList<String>());
while (in.hasNextLine())
{
String line = in.nextLine();
for (int i =0; i<matrix.size(); i++)
matrix.get(i).add(line);
}
in.close();
}
catch(Exception e)
{
String s = e.toString();
}
}
}