< Prev
Next >



else if Statement




In Java, an else-if statement consists of three parts -







Working of else-if


First the condition in the parenthesis of if is evaluated for a boolean value - true or false.






else if statement example


// else if statement example

public class ElseIf
{

public static void main(String... ar)
{
if(99>100)
	System.out.println("99 is greater than 100");
else if(99<90)
	System.out.println("99 is less than 90");
	else
		System.out.println("99 is greater than 90 and less than 100");
}
}
  


Output


99 is greater than 90 and less than 100




Please share this article -

Facebook Google Pinterest Reddit Tumblr Twitter




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

Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page

Notifications



Please check our latest addition

PYTHON