For java practice, i am trying to create a program that reads integers from the keyboard until a negative one is entered.
and it prints the maximum and minimum of th
You could do something like:
Scanner input = new Scanner(System.in); int num; while((num = input.nextInt()) >= 0) { //do something }
This will make num equal to the next integer, and check if it is greater than 0. If it's negative, it will fall out of the loop.