1.5 Java Selection Structures

  • allows a block of code to execute only under a given condition.
  • the selective structures include if, if else, if else if ..., and switch




  • You can have as many else if statements as needed.
  • only one block of code is executed, once one condition is found to be true the balance of the conditions are not checked and the control of the program is passed to the line after the final } in this block of code.