In computer programs, things can go wrong. For instance, you try to open
a file, which does not exist, or you try to divide two numbers, but the
denominator happens to be zero. In the object-oriented programming
language Java, an object is created upon a fault or mistake during run time:
an Exception
is thrown.
We create a straightforward applet in which integer division is demonstrated. If the denominator b is 0, then a problem occurs: an exception is generated by the program.
Somewhere, probably in the Java console, you are notified about the exception. An other problem you can easily create, is to enter a non-integer in one of the input fields. Try any character.