Expressions and Assignment Statements

AP Computer Science A· difficulty 3/5

What is the value of <code>5 + 7 / 2</code>?

  • A

    8

    check_circle
  • B

    6.0

  • C

    6

  • D

    8.5

Explanation

<code>/</code> has higher precedence than <code>+</code>. 7/2 = 3 (int division), then 5 + 3 = 8.

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

Related questions