Q:

Write a method that returns the largest integer in the list

0

Write a method that returns the largest integer in the list.
You can assume that the list has at least one element.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

public Integer maximum(Integer[] list) {
int maximum = list[0];
for (int i : list) {
    if (i > maximum) {
        maximum = i;
    }
}
return maximum;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now