Initialize double array java with enum value -


I have a little problem, I hope you can help me:

I have The class in Java is called TOKEN and inside it is:

  public enum TOKEN {EMPTY, WHITE, BLACK}  
< P> In the other category (the same package) I am trying to create a matrix of arrays with columns and rows, and I am trying to get it started from "class" to second class with "value": < / P>

public class boards {private int line; Private int column; Private token [] [] Board; Public board (int nr, int nc) {this.row = nr; This.column = NC; For (int a = 0; a; l> line; a ++) {for (int b = 0; b

NR, and NC are low and values ​​(for example 6,7) But when I try to run the code, it prevents here (before moving)

board [a] [b] = token Empty;

Can someone help me? Thanks!

You must first initialize the array:

  board = new Token [nr] [nc];  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -