Java if else statement

preview_player
Показать описание
Java tutorial for beginners playlist

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Java if else statement

In this video we will discuss "if else" control flow statement in Java with examples.

if else syntax

if (condition) {
statement1a; // if condition is evaluated true
statement2a;
:
}
else {
statement1b; // if condition is evaluated false
statement2b;
:
}

Please note that opening and closing braces are optional when there is single statement. Else is also optional.

Nested if syntax

if (expression-1)
if (expression-2)
statement-1 ;
else
statement-2 ;
else
if (expression-3)
statement-3 ;
else
statement-4;

Nested if example

if (score ]200) {
if (score [400) {
if (score ]300) {
}
else {
}
else {
}
}
Рекомендации по теме
Комментарии
Автор

one of the best java youtube videos, thanks a lot

prashantsingh
Автор

Yup deepak sir following ur videos continue the great work😃😃

ullasgokarnkar
Автор

give practical example for if else statement sir

vinodkumarreddy