Итак, у меня проблемы с чтением в файле. Файл содержит 2 целых числа в первой строке, а остальная часть файла содержит строки в отдельных строках. По какой-то причине моя логика в этом коде, кажется, не правильно использует каждую строку в файле. Я попытался решить эту проблему, распечатав, что происходит, и похоже, что второй nextLine () даже не выполняется.
while(inputFile.hasNext())
{
try
{
String start = inputFile.nextLine();
System.out.println(start); // tried to troubleshoot here
String [] rowsAndCols = start.split(" "); // part where it should read the first two integers
System.out.println(rowsAndCols[0]); // tried to troubleshoot here
int rows = Integer.parseInt(rowsAndCols[0]);
int cols = Integer.parseInt(rowsAndCols[1]);
cell = new MazeCell.CellType[rows+2][cols+2];
String mazeStart = inputFile.nextLine(); // part where it should begin to read the rest of the file containing strings
String [] mazeRowsAndCols = mazeStart.split(" ");
MazeCell.CellType cell2Add;