Store a 2D array within another array -- Java -


I should be able to store a 2D Boolean array within another array, which is as follows ... < / P>

  Boolean [] [] Player = New Boolean [1] [2]; Object [] game = new object [1]; Player [0] [0] = True; Player [0] [1] = Wrong; Game [0] = player [0] [0];   

I should be able to set every game [] index with a player, but the one above does not work. Is there any way to insert an array into an array?

If you want to store the 2D array game [0] Then you should do

  game [0] = player;   

Other points:

  • I recommend you by creating a player class:

      class player {Boolean flag 1; Boolean flag 2; }   

    Instead of creating arrays of boolean

    After your player array ( game ) the type will be player [] .

  • Start the variable name with a lower name and the names of class begin with the case of capital.

  • If you want to use actually arrays, I suggest you make a game to Boolean [] [] [] .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -