Nested If Statement in Java

Get Into Code provides you with free C++ and Java Course in Hindi/Urdu and also provides you the opportunity to practice your skills to be perfect. In the previous video we have discussed about the If Else Statement in Java. In this video we are going to discuss about Nested If Statement in Java.
Nested If Statement
The word Nested means to place one inside the other. In this way if you place if statement in another if statement then it will become nested if statement. Nested if Statement is also very helpful in performing a certain actions. If the outer most if statement is true then the program will check the inner if statements otherwise if the outer most if statement is false then the program will skip the whole body of the outer most if statement and move on towards the next statement.
Syntax
if (condition){\\ opening bracket
\\ body of first if Statement 
if (condition){
\\ body of second if Statement
}
}\\ closing bracket

Watch The Video Below to Understand Nested If Statement in Java


The best about our site is that we provide our readers to practice their skills because Practice Puts Brain in Your Muscles. So, Go Ahead and Write a Java Program to check whether Student is pass or fail if the number is grater than 70. Print Good Marks otherwise print Average Marks.  ( Student have to take 40 out of 100 marks to pass.)
Respected output will be as
Enter Your Obtained Marks
65
Congratulation, You are passed and have got Average Marks.

No comments

Powered by Blogger.