Skip to content

Glossary: Algorithms Beyond the Basics in Java

overflow

Also written: Math.addExact, ArithmeticException

When a number grows past what its type can hold, Java wraps around silently (a `long` tops out near 9.2 × 10¹⁸). `Math.addExact` throws `ArithmeticException` instead.

Where the book teaches it

Related terms

INF (Integer.MAX_VALUE)