Compound Boolean Expressions

AP Computer Science A· difficulty 3/5

int a = 5;
int b = 10;
boolean c = a < b && b < 20;
System.out.println(c);

What is printed?

  • A

    Error

  • B

    1

  • C

    true

    check_circle
  • D

    false

Explanation

a < b is true and b < 20 is true; true && true is true.

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

Related questions