Advertisement



< Prev
Next >



Nested if Statement





In nested-if decision making statement, an if statement is nested inside an outer if statement, hence it is named nested if.

The statement connected to the nested if statement is only executed when -:



Advertisement




nested if example


// nested if statement 

public class NestedIf
{

public static void main(String... ar)
{
if(99<100)
{
	if(99<101)  // This is a nested if 
	System.out.println("99 is less than 100 & 99 is also less than 101");
}

else 
	System.out.println("99 is not less than 100");
		
}

}


Output


99 is less than 100 & 99 is also less than 101




Please share this article -





< Prev
Next >
< Else-If Statement
Nested If-Else Statement>



Advertisement

Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement

Notifications



Please check our latest addition

PYTHON


Advertisement