Multiple choice

What Java keyword can be used to end a method?

  1. stop

  2. break

  3. return

  4. done

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The 'return' keyword is used in Java to immediately exit from a method and optionally pass back a value to the caller. The 'break' keyword is used to exit loops or switch statements, not methods.