Expressions and Assignment Statements

AP Computer Science A· difficulty 2/5

int result = (2 + 3) * 4;
System.out.println(result);

What is printed?

  • A

    20

    check_circle
  • B

    14

  • C

    24

  • D

    9

Explanation

Parentheses force 2 + 3 = 5 to be evaluated first, then 5 * 4 = 20.

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

Related questions