Advertisement
virtualideaz

Nested If Else (If-else-if-else)

Oct 23rd, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. //
  2. //this is a decision control statement example
  3. //
  4. public class DecisionControlStatements {
  5.     public static void main(String [] args) {
  6.         //the nested if else (if-else-if-else) statement
  7.        
  8.         int a = 11;
  9.        
  10.         if (a <= 10)
  11.         {
  12.             System.out.println("given value : " + a);
  13.             System.out.println("The given value is less than or equal to 10");
  14.         }
  15.         else if (a >=20)
  16.         {
  17.             System.out.println("given value : " + a);
  18.             System.out.println("The given value is greater than 10");
  19.         }
  20.         else
  21.         {
  22.             System.out.println("given value : " + a);
  23.             System.out.println("The given value is neither greater than 10 nor lesser than 20");
  24.         }
  25.     }
  26. }
  27.  
  28. --copy until here--
  29.  
  30. OUTPUT:
  31.  
  32. given value : 11
  33. The given value is neither greater than 10 nor lesser than 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement