Variables and Data Types

AP Computer Science A· difficulty 4/5

Adding 1 to <code>Integer.MAX_VALUE</code> produces

  • A

    Stays at MAX_VALUE

  • B

    Wraps to Integer.MIN_VALUE (overflow)

    check_circle
  • C

    Becomes 0

  • D

    Throws OverflowException

Explanation

Java integer overflow wraps silently; no exception thrown.

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

Related questions