Next: The throws clause
Up: Unit 10
Previous: How to handle exceptions
- NullPointerException: generated when the reference used to
invoke a method has value null, or when we try to access an instance
variable through a null reference. Some methods throw explicitly
this type of exception when they are passed a parameter that is
null.
- ArrayIndexOutOfBoundsException: generated when we access an
element of an array using an index that is less than zero, or bigger than the
length of the array minus one.
- IOException: generated by methods that access input/output
devices when an error situation occurs.
- FileNotFoundException: generated when we try to open a
non-existent file.
- NumberFormatException: generated by methods that perform
conversions from strings to numbers. For example,
Integer.parseInt() generates an exception of this type if the string
passed as parameter does not contain a number.
Next: The throws clause
Up: Unit 10
Previous: How to handle exceptions