public class IfElse { public static void main(String args[]){ /* boolean isAlive = false; if( isAlive ){ System.out.println("I am Alive!"); }else{ System.out.println("Nopes, I am dead."); } // Nested ifs int x = 5; int y = 9; if(x == 5){ if(y == 7){ System.out.println("x is 5 and y is 7"); }else{ System.out.println("x is 5 but y is not 7"); } } */ // if-else-if ladder int x = 4; if(x == 2){ System.out.println("x is two"); }else if(x == 3){ System.out.println("x is three"); }else if(x == 4){ System.out.println("x is four"); }else{ System.out.println("I don't know what x is. :("); } } }