fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Welcome to the menu");
  13. System.out.println("1. Cheeseburger");
  14. System.out.println("2. Hotdog");
  15. System.out.println("3. Chicken Tenders");
  16. Scanner in = new Scanner(System.in);
  17. int choice = in.nextInt();
  18. switch(choice)
  19. {
  20. case 1:
  21. System.out.println("You chose Cheeseburger");
  22. break;
  23. case 2:
  24. System.out.println("Welcome to Hotdog");
  25. break;
  26. case 3:
  27. System.out.println("Welcome to Chicken Tenders");
  28. break;
  29. default:
  30. System.out.println("Not a menu option");
  31. }
  32. }
  33. }
Success #stdin #stdout 0.18s 54556KB
stdin
1
2
3
stdout
Welcome to the menu
1. Cheeseburger
2. Hotdog
3. Chicken Tenders
You chose Cheeseburger