JAVA BASIC PART - 3 DECISION STATEMENT
youtube channel :- madhavgediya
java playlist :- java playlist link
this video like :- java basic part -3
DECISION STATEMENT
There are main 2 decision statement.
If statement
Switch case statement
IF STATEMENT
- Simple if statement
- If…else statement
- If..else if..else statement (ladder if statement)
- Nested if statement
Simple if statement
Syntax :-
if(condition)
{
// True Statements
}
If…else statement
Syntax :-
If(Condition)
{
// True Statement
}
else
{
// False Statement
}
If..else if..else statement (ladder if statement)
Syntax :-
if(Condition- 1)
{
// True Statement - 1
}
elseif(Condition- 2)
{
// True Statement - 2
}
elseif(Condition- 3)
{
// True Statement - 3
}else
{
//Executes when the none of the above condition is true.
}
Nested if statement
Syntax :-
if(Condition - 1)
{
//Executes when the Condition 1 is true
if(Condition - 2)
{
//Executes when the Condition 2 is true
}
else
{
//Executes when the Condition 2 is false
}
}
else
{
if(Condition - 3)
{
//Executes when the Condition 3 is true
}
else
{
//Executes when the Condition 3 is false
}
}
(only for education purpose)
Comments
Post a Comment