Boolean Expressions

AP Computer Science A· difficulty 3/5

A method <code>boolean isReady()</code> is called inside an <code>if</code>. Which is correct?

  • A

    Both work; first is idiomatic

    check_circle
  • B

    if (isReady())

  • C

    if (isReady() == true)

  • D

    Neither

Explanation

Both compile and behave equivalently; first form is preferred.

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

Related questions