Skip to content

Instantly share code, notes, and snippets.

@raws
Created December 12, 2010 16:06
Show Gist options
  • Save raws/738130 to your computer and use it in GitHub Desktop.
Save raws/738130 to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int input;
try {
input = in.nextInt();
} catch (InputMismatchException e) {
System.out.println("You've provided bad input!");
System.exit(1);
}
System.out.println("Thanks for your valid input!");
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment