They are used to cause the flow of execution to advance and branch based on changes to the state of a program. The list shows the Java’s selection statements. |
|
if
Statements
|
|
if
to execute a block of code, if a specified condition is true.
else
to execute a block of code, if the same condition is false.
else if
to specify a new condition, if the first condition is false.
switch
to specify many alternative blocks of code.