3.7. Overflow

An overflow happens when a result is too large for the type of variable that is meant to hold it; that is, the value assigned is too large to be represented by the type. This can happen for a few different reasons, chief among them is that there has been an implicit conversion of type somewhere, or that an expression has evaluated to a result larger than expected.

Java handles overflow differently for integers than it does for floating point values. If an integer overflows, only the least significant bits are stored. Remember that each Integral data type in Java can represent a certain number of values—half of which are negative and half of which (including 0) are positive. That means that exceeding the highest possible positive ...

Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.