Compound Assignment Operators

AP Computer Science A· difficulty 2/5

x = x + 5;

Which statement is equivalent?

  • A

    x++ 5;

  • B

    ++x = 5;

  • C

    x += 5;

    check_circle
  • D

    x =+ 5;

Explanation

The compound assignment x += 5 is shorthand for x = x + 5.

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

Related questions