T student Im wondering if the user input a Character not an integer.How can i Show the word INVALID to him and let him Type again.
EXAMPLE:
input a two number
a
INVALID try Again:1
2
Sum of two number=3
public static void main(String[] args) {
    int x = 0, y, z;
    System.out.println("Enter two integers to calculate their sum");
    Scanner in = new Scanner(System.in);
    try {
        x = in.nextInt();
    } catch (InputMismatchException e ) {
        System.out.print("INVALID");
    }
    y = in.nextInt();
    z = x + y;
    System.out.println("Sum of the integers = " + z);
}
 
     
    