Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Arithmetic Overflow Errors

807601May 20 2008 — edited May 20 2008
I remember that when Java was first introduced, one of the major design goals of the language was to eliminate common programmer errors. For example, instead of trusting the programmer to read the documentation of a given function to learn that they needed to test for a negative return value as an error, java included a very rigorous exception handling requirement. The developer who wrote a method would declare which exceptions it could throw and those using the method were required to account for those exceptions.

I'm now starting to work with Java on a full time basis and was reviewing the arithmetic rules. I couldn't believe it when I discovered that overflowing an integer value doesn't cause an arithmetic overflow error!

Am I missing something, or is that a major deviation from the stated language design goals?!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 17 2008
Added on May 20 2008
5 comments
173 views