Java if else condition example 2


Java if-else statement is used to check condition whether it is true or false. If the first condition is false then it will finally run the else condition.

Program
public class Ifelsecondition{ public static void main(String args[]){ int x=5; if(x>6){ System.out.println("x is greater than 6"); } else{ System.out.println("x is smaller than 6"); } }}
Input
Output