-
-
Save kasramp/2987aa956072eb35150a0c0fd8d6c811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scanner input = new Scanner(System.in); | |
int x = 0; | |
try { | |
x = input.nextInt(); | |
if(x < 1) { | |
throw new InputMismatchException(); | |
} | |
} catch(InputMismatchException e) { | |
System.out.println("You input wrong number!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment