/* * Catch any and all errors (type mis-match errors) that way we don't * crash the user of this program :-) */ try { /* * Ask the user for how many test scores will be entered */ System.out.print("Enter the number of test scores to be entered: "); /* * Grab the test scores count */ numberOfEntries = sc.nextInt(); } /* * Catch that bad error! */ catch(InputMismatchException e) { /* * Discard the invalid data entry */ sc.next(); /* * Notify the user of their mistake */ System.out.println("Error! Invalid number. Please try again.\n"); /* * Jump back into the loop */ continue; }