How the Java virtual machine handles exceptions | JavaWorld
From Sorry More like this JavaWorld | Jan 1, 1997 12:00 AM PT finally clauses -- that's next month's topic. Subsequent articles will discuss other members of the bytecode family. Exceptions Exceptions allow you to smoothly handle unexpected conditions that occur as your programs run. To demonstrate the way the Java virtual machine handles exceptions, consider a class named NitPickyMath NitPickyMath performs these mathematical operations the same as the normal operations offered by Java's "+", "-", "*", "/", and "%" operators, except the methods in NitPickyMath ArithmeticException on an integer divide-by-zero, but will not throw any exceptions on overflow and underflow. The exceptions thrown by the methods of NitPickyMath A simple method that catches and throws exceptions is the remainder The remainder method simply performs the remainder operation upon the two ints passed as arguments.Read full article from How the Java virtual machine handles exceptions | JavaWorld
No comments:
Post a Comment