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

How do I initialize 2d array in java? int[][] box = new int[5][10]; I have 5 row

ID: 3832444 • Letter: H

Question

How do I initialize 2d array in java?

int[][] box = new int[5][10];

I have 5 rows and 10 column of boxes

I want to assign numbers to each boxes like this- 1a, 1b, 1c

All the rows should be in this order- a, b, c, d, e, f

All the column should be in this order- 1,2,3,4,5,6,7,8,9,10

So, for example,

[0][0] will be = 1a

[0][1] will be = 2a

[0][2] will be = 3a

[1][1] will be = 2b

[1][2] will be = 3b

[1][6] will be = 7b

//I don’t want to print it, I just need to initialize the 2d array as 1a, 2a,1b,2b like this

Can someone help me with this one?

Thanks

Explanation / Answer

char row= 'a' ;

for(int i=0;i<5;i++)

{

for(j=1;j<=10;j++)

{

string val= j+""+row;

}

row++;

j=1;

}

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