Compound Assignment Operators

AP Computer Science A· difficulty 3/5

int n = 23;
n %= 6;
System.out.println(n);

What is printed?

  • A

    0

  • B

    3

  • C

    4

  • D

    5

    check_circle

Explanation

n %= 6 sets n equal to n % 6; 23 % 6 = 5.

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

Related questions

AP Computer Science A · Compound Assignment Operators Practice Question | Acemy