Boolean Expressions

AP Computer Science A· difficulty 4/5

<code>String label = (n == 1) ? "item" : "items";</code> is equivalent to

  • A

    Conditional assignment via if-else

    check_circle
  • B

    Always returns 'items'

  • C

    Same as switch

  • D

    Compile error

Explanation

Inline conditional expression.

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

Related questions