Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.util.Scanner;
- class Example {
- public static void main(String args[]) throws IOException {
- int start_ans = 0;
- Scanner in = new Scanner(System.in);
- do {
- System.out.println(" [1] one\n [2] two\n [3] three");
- try {
- start_ans = in.nextInt();
- } catch(Exception e) {
- System.out.println("Error");
- in.next();
- }
- } while(start_ans != 1 && start_ans != 2 && start_ans != 3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement