Advertisement
rafibatam

Decision If - Else and Switch Case

Jan 13th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. public class Decision {
  2.     public static void main(String[] args) {
  3.         if(3 < 5) {
  4.             System.out.println("Hello World!");
  5.         }
  6.        
  7.         else {
  8.             System.out.println("Don't say Hello World!");
  9.         }
  10.        
  11.         char word = 'B';
  12.         switch(word) {
  13.        
  14.         case 'A' : System.out.println("\nHow Are You?");
  15.             break;
  16.            
  17.         case 'B' : System.out.println("\nPlease introduce yourself.");
  18.             break;
  19.            
  20.         case 'C' : System.out.println("\nHello There!");
  21.             break;
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement