Compound Boolean Expressions

AP Computer Science A· difficulty 3/5

Which expression is true if x is between 0 and 10 inclusive?

  • A

    x > 0 && x < 10

  • B

    x >= 0 && x <= 10

    check_circle
  • C

    0 <= x <= 10 (Java doesn't allow this)

  • D

    x >= 0 || x <= 10

Explanation

Java requires explicit <code>&&</code>; chained comparisons aren't allowed.

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

Related questions