Find the maximum
Given a List of Integer, intList, find the maximum value.
Algorithm Steps:
Initialize an integer variable max
Loop through the List, checking each value against max
If a larger number is found, set max to the higher number
Print the maximum value to the console.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class CodingQuestion {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
List intList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
intList.add(in.nextInt());
}
/* DO NOT CHANGE CODE ABOVE THIS LINE */
// Write the code to find the maximum value in intList
} // end of the main() method
}
STDOUT
Expected STDOUT
10