Compound Boolean Expressions

AP Computer Science A· difficulty 1/5

boolean b = true;
System.out.println(!b);

What is printed?

  • A

    false

    check_circle
  • B

    true

  • C

    !true

  • D

    1

Explanation

The ! operator negates a boolean value. !true evaluates to false.

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

Related questions