When adding code tags, you have to highlight all the code before clicking the code button, I've fixed the code tags for you this time.
Please can you tell us what the errors are ie cut and paste the compiler/runtime error messages into a post here. It's hard to fix something when we've no idea what is wrong with it and personally I don't have the time or the Board class to be be able to test your code myself.
Ulf Dittmer wrote:For starters, you're trying to declare a class inside of a method (the main method) - that is not possible. The code is also missing a closing "}", but I guess that may just be a copy/paste error.
Declaring a class inside a method is possible, and it's called a local class.
Ulf Dittmer wrote:What is shown above is not a local class -snip-
Really? Well, according to this, it seems like a local class to me:
I do agree, of course, that the OP is not using it correctly, as, to be able to use it, they would have had
to define it above where they are referencing it, in the same block as they are referencing it. What this means
is that they are actually referencing the Board class they imported, not the one they defined at the bottom of
the method. I have no clue why they would define a local class called Board in the first place, if they already
have an external class of the same name, which is probably the class they want to use.
The problem is in the outer loop
you should be iterating whilst r1 is less than cells.length.
at line 21 in the board class I changed it to read
Sorry I said to look at line 21 but I should have said line 19, although if you had read my description of the error in the earlier post I'm sure you would have worked that out.
I don't understand why you would change line 21 to a print statement - do you mean you inserted a print statement?
If you removed the array initialization then you would get NullPointerExceptions elsewhere in your code.