I am trying to get a hold of overflow and underflow exceptions in java, but couldn't get any nice tutorial. Specifically I wish to learn
Any link to useful tutorial will do
Okay, the OP talked about wanting to know about both stack overflow and arithmetic overflow, as well as their corresponding underflow. Here goes....
int
holds values between -231 and 231-1, inclusive. If your number goes over these limits, an overflow occurs, and the number "wraps around". These do not cause an exception to be generated in Java.StackOverflowError
when that happens.To answer the OP's other question (see comments), when you overstep the boundaries of an array, an IndexOutOfBoundsException
is issued.