Question: Evaluate the code below. // Returns the largest value in the given //array. public static int max(int data[10]) { int max = 0; for (int
Evaluate the code below.
// Returns the largest value in the given //array.
public static int max(int data[10]) {
int max = 0;
for (int i = 0; i <
data[].length(); i++) {
if (array[i] > max) {
max = array[i];
}
}
return max[];
}
// please disregard how for loop switches on a new line, its just
// a formatting typo.
The above attempted code problem "max" has problems. Fix all the errors. Complete the code so that it compiles and passes the test cases (create some yourself and run).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
