enter image description hereOnce I enter in the list. it will not display the maximum. I tried to call in max in the last println it still did not work.
ArrayList<Double> numbers = new ArrayList<Double>();
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter a list of numbers: ");
while (keyboard.hasNextDouble())
{
double input = keyboard.nextDouble();
numbers.add(input);
}
Double max = Collections.max(numbers);
System.out.println("The Maximum is: " );
}}
keyboard.hasNextDouble()returns false if the input value is not a validdoublestring. So you can break it by typing something like "break me", "kill me", "quit" anything that's not a double value.System.out.printlnwill be executed, also check answer from Scary Wombat, you haven't appended themaxto your print statement, right now it's just printingThe Maximum is: