Java OCA OCP Practice Question 372

Question

Which statement immediately exits a switch statement, skipping all remaining case or default branches?

  • A. exit
  • B. break
  • C. goto
  • D. continue


B.

Note

The break statement exits a switch statement, skipping all remaining branches, making Option B the correct answer.

In Option A, exit is not a statement in Java.

In Option C, goto is a reserved word but unused in Java.

In Option D, continue is a statement but only used for loops.




PreviousNext

Related