Chapter 11: Exceptions and Localization
Cheatsheet

Chapter 11 Cheatsheet

  • throws: In class/ method declaration
  • throw: Within a clause
  • throw new RuntimeException();
  • throw RuntimeException();

Exception tree

Checked exceptions

Checked exceptions extend Exception, they MUST be declared or handled.

  1. IOException
  2. FileNotFoundException
  3. NotSerializableException
  4. ParseException
  5. SQLException

Unchecked exceptions

Unchecked exceptions extends RuntimeException, they DON'T NEED to be declared or handled.

  1. ArithmeticException
  2. ArrayIndexOutOfBoundException
  3. ClassCastException
  4. NullPointerException
  5. IllegalArgumentException
  6. NumberFormatException

Error class

  1. StackOverflowError
  2. ExceptionInInitializerError
  3. NoClassDefFoundError

Super exceptions & sub exceptions

  1. IOException (super) -> FileNotFoundException (sub)
  2. IllegalArgumentException (super) -> NumberFormatException (sub)