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
A simple loop can solve your problem.
Scanner s = new Scanner(System.in); int num = 1; while(num>0) { num = s.nextInt(); //Do whatever you want with the number }
The above loop will run until a negative number is met.
I hope this helps you