Question: (Java Programmin): Sum() and max() in ArrayList a. Write a method that returns the maximum value in an ArrayList of integers. The method returns null
(Java Programmin):
Sum() and max() in ArrayList
a. Write a method that returns the maximum value in an ArrayList of integers. The method returns null if the list is null or the list size is 0.
public static Integer max(ArrayList
b. Write a method that returns the sum of all numbers in an ArrayList:
public static Integer sum(ArrayList
c. Write a test program that prompts the user to enter a sequence of numbers ending with 0, and invokes sum and max methods to output the sum and the largest number in the input.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
