java if else if ladder

Solutions on MaxInterview for java if else if ladder by the best coders in the world

showing results for - "java if else if ladder"
Lucia
28 Sep 2020
1
2import java.io.*; 
3  
4class GFG { 
5    public static void main(String[] args) 
6    { 
7        // initializing expression 
8        int i = 20; 
9  
10        // condition 1 
11        if (i == 10) 
12            System.out.println("i is 10\n"); 
13  
14        // condition 2 
15        else if (i == 15) 
16            System.out.println("i is 15\n"); 
17  
18        // condition 3 
19        else if (i == 20) 
20            System.out.println("i is 20\n"); 
21  
22        else
23            System.out.println("i is not present\n"); 
24  
25        System.out.println("Outside if-else-if"); 
26    } 
27}