Question: Consider the following code segment. public static int findMaxValue ( int [ ] [ ] arr ) { int max = 0 ; for (
Consider the following code segment.
public static int findMaxValueint arr
int max ;
for int i ; i arr.length; i
for int j ; j arrlength; j
if arrij max
max arrij;
return max;
Which of the following options identifies the error in the given code segment?
A The initial value of max should be set to Integer.MINVALUE instead of
B The loop condition for the outer loop should be i arr.length
C The loop condition for the inner loop should be j arr.length
D The condition arrij max should be arrij max.
E The return type of the method should be void instead of int.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
