Java   View all facts   Glossary   Help
syntactic unit > statement > control flow statement > decision making statement > if-else statement > nested if-else statement
Upif-else statement

nested if-else statement
subjectfact 
nested if-else statementhas example
if (length < 10) {
System.out.println("Small");
} else {
if (length < 20){
System.out.println("Medium");
} else {
System.out.println("Large");
}
}
added by: JK, 2001-10-19 11:37:29.0
is a subtopic of Loops and Decision Making2001-10-19 11:37:29.0
is a kind of if-else statementadded by: JK, source: On To Java, 2001-10-19 11:37:29.0
may contain an if statement or an if-else statement as its embedded statementsadded by: JK, source: On To Java, 2001-10-19 11:37:29.0
if-else statementcan omit braces if there is only one embedded statement2001-10-19 11:36:52.0
has part else block2001-10-19 11:36:52.0
has syntax
if (boolean expression) {
if-true statement
else
if-false statement
}
2001-10-19 11:36:53.0
decision making statementhas purpose to make a decision on which branch of code to follow in a program2001-10-19 11:36:35.0
statementis terminated by a semicolon    2001-10-19 11:37:57.0
should be not more than one line long if possible2001-10-19 11:37:57.0
syntactic unithas syntax rule
bold = mandatory
italic = non-terminal
normal font = optional
2001-10-19 11:38:04.0