HOW CAN I DISPLAY AN ERROR MESSAGE - JAVA : I am a beginner, and I have to write a code that calculates the area and circumference from the radius the user gives me. that part was easy, but the teacher also wanted me to only accept valid integers and have the user re-enter a value when his input is incorrect ...

so i was able to have it display the error message for every case except when they enter an negative integer:

     import java.util.Scanner;
     public class GetCircle
     {
	     public static void main(String []args)
	     {
		
		Scanner input = new Scanner(System.in);
		 int radius;
		 do {
		System.out.print("Please enter size of radius (Must be integer): ");
		while (!input.hasNextInt()) {
			System.out.print("That is not a valid number, please try again :");
			input.next();
		}
		
		radius = input.nextInt();
		
	    } while (radius < 0);
	    
        System.out.println("The radius is: " + radius);
		 
	    }
    }
 

and so this is what I get as a result:

Please enter size of radius (Must be integer): aaa

That is not a valid number, please try again :4.5555

That is not a valid number, please try again :-5

Please enter size of radius (Must be integer): -5

Please enter size of radius (Must be integer): -8.777

That is not a valid number, please try again :-4

Please enter size of radius (Must be integer): 

** so whenever its a negative integer it doesn't display the error message...

how can i fix this please?
