Nested Else If Statements in Java.
100% Working Code and Projects.
if you need any help about project and Application Contact Shelly at:+917888361589.
Java Code Given below :-
package abheer;
public class NestedIfelse {
public static void main(String args[])
{
int English=40;
int Maths=70;
int Total=70;
if(Total>45)
{
if(Maths>60)
{
if(English>60)
{
System.out.println("Mobile");
}
else{
System.out.println("Cycle");
}
}
else
{
System.out.println("No Cycle");
}
}
else
{
System.out.println("nothing");
}
}
}
Output :-
Cycle
Explanation:-
In this program, we are using if else statement within the if else statement. Now, in this , there will be more than one condition and every condition will be checked. If one condition gets false than that else part of that if statement will be executed. if first condition gets false then nothing will executed except else part of that if.
0 Comments:
Post a Comment