
How we can use if and else if statement?

public class IfElseExample {
public static void main(String [] args){
int i= 10;
if(i < 100)
System.out.println("Grater than 100");
else if(i < 50)
System.out.println("Grater than 50");
else
System.out.println("Less than 50");
}
}
Output
Grater than 100
Description:- In this example. We have used if and else if statement. This example finds out grater than number. In the main method.