The static method belows reads an int value from the console using Scanner class.
Code:public static int readIntValue() throws InputMismatchException
{
Scanner in = new Scanner(System.in);
int integer;
System.out.println("Enter an integer value: ");
integer = in.nextInt();
return integer;
}
