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

using java 12. Define and create an array of 10 integers. The array elements sho

ID: 3586600 • Letter: U

Question


using java

12. Define and create an array of 10 integers. The array elements should be initialized to zero. 13. Define and create an array with these values using an initializer list: 9, 18, 3, 0, 12 14. Using the array created in 13, replace element in position (index) 2 with the value 99 15. Print the elements of the array created in 13 from the last element to the first. 16. Define and create a 2-dimensional array of integers with 4 rows and 8 columns 17. Print the elements of the array created in 16 in table format (rows and columns) 18. Replace the element in the second row, third column of the array created in 16 with the value 99.

Explanation / Answer

12.

int[] array1 = new int[10];

13.

int[] array2 = { 9, 18, 3, 0, 12 };

14.

array2[ 2 ] = 99;

15.

for(int i = array2.length - 1; i >= 0; i--)

System.out.println( array2[i]);

16.

int[][] array3 = new int[4][8];

17.

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

{

for(int j = 0; j < 8; j++)

{

System.out.print(array3[i][j]+" ");

}

System.out.println();

18.

array3[ 1 ][ 2 ] = 99;

12.

int[] array1 = new int[10];

13.

int[] array2 = { 9, 18, 3, 0, 12 };

14.

array2[ 2 ] = 99;

15.

for(int i = array2.length - 1; i >= 0; i--)

System.out.println( array2[i]);

16.

int[][] array3 = new int[4][8];

17.

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

{

for(int j = 0; j < 8; j++)

{

System.out.print(array3[i][j]+" ");

}

System.out.println();

}

18.

array3[ 1 ][ 2 ] = 99;