Respuesta :
Answer:
Option C: {{4, 1, 7}, {-10, -11, -12}}
Explanation:
There is a logical error in the inner loop.
for (int j = 0; j < num.length; j++)
It shouldn't be "j < num.length" as the iteration of the inner loop will be based on the length of the row number of the two dimensional array. The inner loop is expected to traverse through the every column of the same row in the two dimensional array and sum up the number. To fix this error, we can change it to
for (int j = 0; j < r.length; j++)
The sumRows method adds up all elements in each row, and prints the calculated sum.
The sumRows method would not work for input values (c) {{4, 1, 7}, {-10, -11, -12}}
In the inner loop of the sumRows method, we have
for (int j = 0; j < num.length; j++)
The above loop iterates from 0 to one less than the number of columns in the array.
Take for instance, {{10, -18}, {48, 17}} has 2 rows, and 2 columns.
So, the iteration would be for elements at indices 0 and 1.
However, the array {{4, 1, 7}, {-10, -11, -12}} has 3 rows and 2 columns
So, the iteration would be for elements at indices 0 and 1; leaving the element at index 2
Hence, the sumRows method would not work for input values (c) {{4, 1, 7}, {-10, -11, -12}}
Read more about methods at:
https://brainly.com/question/23052617