Answers for "Example 2 of an IF..ELSE IF Statement"

0

Example 2 of an IF..ELSE IF Statement

public class Test {

   public static void main(String args[]) {
      int x = 30;

      if( x == 10 ) {
         System.out.print("Value of X is 10");
      }else if( x == 20 ) {
         System.out.print("Value of X is 20");
      }else if( x == 30 ) {
         System.out.print("Value of X is 30");
      }else {
         System.out.print("This is else statement");
      }
   }
}
Posted by: Guest on August-31-2021

Browse Popular Code Answers by Language