202k views
1 vote
Show the printout of the following code.

public class Test {
public static void main(String[] args) {
double[][] m = {{1, 2, 3}, {1.5, 2.5, 3.5}, {0.1, 0.1, 0.1}};
System.out.println(sum(m));
}

public static double sum(double[][] m) {
double sum = 0;

for (int i = 0; i < m.length; i++)
sum += m[i][i];

return sum;
}
}

A). 3
B). 4
C). 4.0
D). 3.6
E). 3.0

1 Answer

0 votes

Answer:

E. 7.0

Step-by-step explanation:

the 7 of the out of the older and make a shame of waves and force of trying

User Nazbot
by
8.2k points