Exception Handling

Cards (21)

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

    The process used to change the normal flow of code execution if a specified exception occurs
  • Checked Exceptions
    • ClassNotFoundException
    • IllegalAccessException
    • InstantiationException
    • NoSuchMethodException
  • ClassNotFoundException
    The class is not found
  • IllegalAccessException

    Access to a class is denied
  • InstantiationException
    Attempt to create an object of an abstract class or an interface
  • NoSuchMethodException
    A requested method does not exist
  • Unchecked Exceptions
    • ArithmeticException
    • ArrayIndexOutOfBoundsException
    • ArrayStoreException
    • InputMismatchException
    • NullPointerException
    • NumberFormatException
    • StringIndexOutOfBoundsException
  • ArithmeticException
    Arithmetic error, such as an integer divided by 0
  • ArrayIndexOutOfBoundsException

    Accessing an invalid index of the array
  • ArrayStoreException
    Assigning a value to an array index that does not match the expected data type
  • InputMismatchException
    Entering a value that does not match the expected data type
  • NullPointerException
    Invalid use of a null reference
  • NumberFormatException
    Invalid conversion of a string to a numeric format
  • StringIndexOutOfBoundsException
    Accessing an invalid index (character) of a string
  • 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
  • getMessage()
    A method that can be used to determine Java's message about the exception
  • finally block
    Contains statements which are executed whether or not an exception is thrown
  • user-defined exception
    Created by extending the Exception class
  • throw statement

    Sends an exception out of a block or a method so it can be handled elsewhere