Java   View all facts   Glossary   Help
syntactic unit > statement > control flow statement > decision making statement > if-else statement
Next decision making statementswitch-case statement    Updecision making statement    Previous decision making statementif statement   

if-else statement comparison table
Subject terminate by omit have example have syntax have purpose be have syntax rule contain is a subtopic of is a kind of have part
nested if-else statementa semicolonbraces if there is only one embedded statement
if (length < 10) {
System.out.println("Small");
} else {
if (length < 20){
System.out.println("Medium");
} else {
System.out.println("Large");
}
}
if (boolean expression) {
if-true statement
else
if-false statement
}
to make a decision on which branch of code to follow in a programnot more than one line long if possible
bold = mandatory
italic = non-terminal
normal font = optional
an if statement or an if-else statement as its embedded statementsLoops and Decision Makingif-else statementelse block

Next decision making statementswitch-case statement    Updecision making statement    Previous decision making statementif statement