// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.*;

public class Menu {
   public static void main(String[] args) throws Exception {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      while(true) {
         System.out.println("Choose:");
         System.out.println("  1: write A");
         System.out.println("  2: write B");
         System.out.println("  3: exit");
         System.out.print("Choice: ");
         int choice = Integer.parseInt(br.readLine());
         switch(choice) {
            case 1:
               System.out.println("A");
               break;
            case 2:
               System.out.println("B");
               break;
            case 3:
            default:
               System.exit(0);
               break;
         }
      }
   }
}
