1 public class TestWin{
2 public static void main(String[] args){
3 int n;
4 hexagon[][] board;
5
6 n = 4;
7 board = new hexagon[n][n];
8 board[0][0].value = 'R';
Hi. javac doesn’t like what I did on line 8. Does anyone know why?
Spot on kwatford. All you have done with line 7 is to tell java to create space for n*n Hexagon objects in a 2 dimensional array.
You will still need to call new for each of these Hexagons
Essentially, you need to replace line 7 with something like: