Hi thereim attempting to create a set of arrays within an ar
Hi there,im attempting to create a set of arrays within an array and im a little lost on how to start.
I have already asked( on november 1st ), but I am asking again because nobody could answer my question, and I find that highly unusual.
this boils down to
sequence[1][16]
sequence [2][16]
sequence [3][16]
sequence [4][16]
sequence [5][16]
I need help understanding what needs to go in my public magictrick at the bottom.
public class MagicTrick
{
public final int NUM_OF_SEQUENCES = 5;
public final int NUMBERS_PER_SEQUENCE = 16;
private ArrayList[] sequences;
public MagicTrick()
{
//text would go here.
}
Solution
Hi, You can create like this:
public class MagicTrick
{
public final int NUM_OF_SEQUENCES = 5;
public final int NUMBERS_PER_SEQUENCE = 16;
// 2-D array reference (array of array)
private int[][] sequences;
public MagicTrick()
{
// creating an array of array
sequences = new int[NUM_OF_SEQUENCES][NUMBERS_PER_SEQUENCE];
}
}
Please let me know in case of any issue

