05

Cards (12)

  • Exception
    An event that occurs during the execution of a program that disrupts the normal flow of instructions
  • Exception handling

    The process used to change the normal flow of code execution if a specified exception occurs
  • Checked exceptions
    • ClassNotFoundException
    • IllegalAccessException
    • InstantiationException
    • NoSuchMethodException
  • Unchecked (runtime) exceptions
    • ArithmeticException
    • ArrayIndexOutOfBoundsException
    • ArrayStoreException
    • InputMismatchException
    • NullPointerException
    • NumberFormatException
    • StringIndexOutOfBoundsException
  • try block
    A block of code that might throw an exception that can be handled by a matching catch block
  • catch block
    A segment of code that can handle an exception that might be thrown by the try block that precedes it
  • The getMessage() method can be used to determine Java's message about the exception
  • Only one (1) try block is accepted in a program but there can be multiple catch blocks
  • User-defined exception
    Created by extending the Exception class
  • finally block
    Contains statements which are executed whether or not an exception is thrown
  • There can only be one (1) finally block after a try-catch structure but it is not required
  • A throw statement sends an exception out of a block or a method so it can be handled elsewhere