Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi there,im attempting to create a set of arrays within an array and im a little

ID: 3936723 • Letter: H

Question

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.

}

Explanation / Answer

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote