Complete Java masterclass for beginners -09 (If-else statement)

Java If-else Statement The Java if statement is used to test the condition. It checks boolean condition: true or false . There are various types of if statement in Java. if statement if-else statement if-else-if ladder nested if statement Java if Statement The Java if statement tests the condition. It executes the if block if condition is true. Syntax: if (condition){ //code to be executed } Example: //Java Program to demonstate the use of if statement. public class IfExample { public static void main (String[] args) { //defining an 'age' variable int age= 20 ; //checking the age if (age> 18 ){ ...