If the array myArray is declared as int myArray new int34 W

If the array myArray is declared as
   int[][] myArray = new int[3][4];
Which of the following loops will set all the cells of the array equal to 10?

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

*** Please select the correct option for the JAVA question and please explain in simple steps why it is the correct answer

If the array myArray is declared as
   int[][] myArray = new int[3][4];
Which of the following loops will set all the cells of the array equal to 10?

Selected Answer: \"Incorrect\"

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

Answers:

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

\"Correct\"

for (int i=0; i     for (int j=0; j        myArray[i][j] = 10;

*** Please select the correct option for the JAVA question and please explain in simple steps why it is the correct answer

Solution

Declaration :

for (int i=0; i<myArray.length; i++)
for (int j=0; j<myArray[i].length)
myArray[i][j] = 10;

If the array myArray is declared as int[][] myArray = new int[3][4]; Which of the following loops will set all the cells of the array equal to 10? for (int i=0;

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site