Advertisement
wadkat

switch and break java

Nov 2nd, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package switchcase;
  7. import java.util.Scanner;
  8. /**
  9. *
  10. * @author pclab
  11. */
  12. public class Switchcase {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18. Scanner keyboard=new Scanner(System.in);
  19. int no;
  20. System.out.println("Number=? ");
  21. no=keyboard.nextInt();
  22.  
  23. switch (no)
  24. {
  25. case 1:
  26. System.out.println("1");
  27. break;
  28. case 2:
  29. System.out.println("2");
  30. break;
  31. case 3:
  32. System.out.println("3");
  33. break;
  34. case 4:
  35. case 5:
  36. System.out.println("4 or 5");
  37. break;
  38. default:
  39. System.out.println("niggerfaggot");
  40. break;
  41.  
  42. }
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement