Please show the screenshots in IDE to make sure the programworks.
(Maximum element in an array) Implement the following methodthat returns the maximum element in an array:
public static <E extends Comparable<E>> E max(E[ ]list)
Answer
public class GenericMaxComparable { public static <E extends Comparable<E>> E max(E[] list) { E maxValue = list[0]; for (int i = 0; i < list.length; i++) { if (list[i].compareTo(maxValue) > 0) {
OR
OR