Norm Radder wrote:
The text files now get created. But, the files are empty.
What is written to the console when the program executes?
There needs to be more info printed on line 32. Add fileName and saveState to the println() statement so you can see what the code sees when it executes.
I don't see a close() so the buffer isn't being written to disk.
Also see http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
Norm Radder wrote:
The text files now get created. But, the files are empty.
What is written to the console when the program executes?
There needs to be more info printed on line 32. Add fileName and saveState to the println() statement so you can see what the code sees when it executes.
Norm Radder wrote:From line 4:
Note: Using the length of the first row (cells[0].length() ) assumes that all the rows have the same length.
It might be better to use the code from line 39 that uses the length of the current row:
Norm Radder wrote:
it is not generating the output files.
Are the statements on line 30 and 31 being executed?
Is the problem that the files are created but they are empty or are the files not being created?
Norm Radder wrote:
Exception in thread "main" java.lang.NullPointerException
at games.board.Board.toString(Board.java:40)
Look at line 40 and find the variable with the null value. Then backtrack in the code to see why that variable does not have a valid value.
You might need to print the values of the variables: "r" and c to see where they refer.
Also the Arrays class's deepToString() method is useful for showing the contents of a 2 dim array for debugging:
NOTE to forum moderators: I was unable to refer to the variable "r" without the "s. The forum software wanted to see "are" not the "r" without quotes.