Page 1 of 1

23. Consider the following method, which is intended to print the values in its two-dimensional integer array parameter

Posted: Thu May 05, 2022 1:11 pm
by answerhappygod
23 Consider The Following Method Which Is Intended To Print The Values In Its Two Dimensional Integer Array Parameter 1
23 Consider The Following Method Which Is Intended To Print The Values In Its Two Dimensional Integer Array Parameter 1 (26.1 KiB) Viewed 84 times
23 Consider The Following Method Which Is Intended To Print The Values In Its Two Dimensional Integer Array Parameter 2
23 Consider The Following Method Which Is Intended To Print The Values In Its Two Dimensional Integer Array Parameter 2 (26.74 KiB) Viewed 84 times
23. Consider the following method, which is intended to print the values in its two-dimensional integer array parameter in row-major order. public static void rowMajor (int[] [] arr) /* missing code */ } As an example, consider the following code segment. int[] [] theArray = {(1, 2), (3, 4), (5, 6), (7, 8)); rowMajor (theArray); When executed, the code segment should produce the following output. 1 2 3 4 5 6 7 8
Which of the following code segments can replace / missing code so that the rowMajor method works as intended? (A) for (int j : arr) for (int k = j) ( System.out.print (j + " "); } (B) for (int j : arr) for (int k: 3) System.out.print (k+ " "); (C) for (int[] arr) for (int k = j) ( System.out.print (j + " "); (D) for (int[] j arr) for (int k : 1) ( System.out.print (k+ " "); (E) for (int[] j : arr) for (int k = j) System.out.print (arr[k] + " ");