Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int readInput() {
- int nr = -1;
- do {
- if (scanner.hasNextInt()) {
- nr = scanner.nextInt();
- } else {
- System.out.println("\nTegemist ei ole numbriga.\nPalun sisestage number.\n\n");
- break;
- }
- } while (nr < 0);
- scanner.nextLine(); // read the rest of the line
- return nr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement