Skip to main content

Overflow

Definition:
When a value exceeds the maximum or minimum limit of its data type, causing it to wrap around.


Detailed Explanation

  • Overflow occurs when arithmetic exceeds a type’s representable range.
  • In fixed-width integers, it wraps around to the opposite extreme.
  • Floating-point overflow results in special values like infinity.

Example

// Integer overflow example // byte b = 127; // b++; // wraps to -128


⬅ Back