if Statements and Control Flow

AP Computer Science A· difficulty 3/5

A return statement inside an <code>if</code> block

  • A

    Has no effect

  • B

    Returns from method, skipping rest of method

    check_circle
  • C

    Returns from the if only

  • D

    Throws exception

Explanation

<code>return</code> always exits the entire method.

Want 10 more like this — adaptive to your weak spots?

Related questions