Question: Consider the method below. What is output by the client code? //go method to be used to process a two-dimensional array public static int go(int[][]

Consider the method below. What is output by the client code?

//go method to be used to process a two-dimensional array

public static int go(int[][] tMat){

int total = 0;

for(int r = 0; r

for(int c = 0; c

total = total + tMat[r][c];

return total;

}

//////////////////////////////////////////////////////////////////////////////

//client code

int[][] mat = {{4,7,5},

{2,6,5},

{1,1,3}};

System.out.println( go( mat ));

a.)

31

b.)

29

c.)

34

d.)

17

e.)

19

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!