-
-
Save kvalv/99310c33787feab69cf4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| void run () throws NumberFormatException{ | |
| Scanner scan = new Scanner(System.in); | |
| scan.useDelimiter("[0-9]+"); | |
| while ( true ) { | |
| try { | |
| String inputLine = scan.nextLine(); | |
| int parseInt = Integer.parseInt(inputLine); | |
| System.out.println("input was: " + Integer.toString(parseInt)); | |
| } catch (NumberFormatException e) { | |
| System.out.println( e.toString() ); | |
| } | |
| } | |
| } |
This file contains hidden or 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
| void run () throws NumberFormatException{ | |
| Scanner scan = new Scanner(System.in); | |
| while ( !scan.hasNextInt() ) { | |
| int nextScore = scan.nextInt(); | |
| hsc.addResult( nextScore ); | |
| } | |
| } |
This file contains hidden or 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
| void run () throws NumberFormatException{ | |
| Scanner scan = new Scanner(System.in); | |
| scan.useDelimiter("[0-9]+"); | |
| try { | |
| while ( true ) { | |
| String inputLine = scan.nextLine(); | |
| int parseInt = Integer.parseInt(inputLine); | |
| System.out.println("input was: " + Integer.toString(parseInt)); | |
| } | |
| } | |
| catch (NumberFormatException e) { | |
| System.out.println( e.toString() ); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment