Advertisement
dimon2242

Untitled

Aug 28th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.util.Scanner;
  3. class Example {
  4.     public static void main(String args[]) throws IOException {
  5.         int start_ans = 0;
  6.         Scanner in = new Scanner(System.in);
  7.         do {
  8.             System.out.println(" [1] one\n [2] two\n [3] three");
  9.             try {
  10.                 start_ans = in.nextInt();
  11.         } catch(Exception e) {
  12.             System.out.println("Error");
  13.             in.next();
  14.         }
  15.         } while(start_ans != 1 && start_ans != 2 && start_ans != 3);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement