Exception Handling (Midterms)

Cards (47)

  • is an event that occurs during the execution of a program that disrupts the normal flow of instructions.
    EXCEPTION
  • What is an exception?
    An exception is an event that disrupts the normal flow of a program's execution.
  • process used to change the normal flow of code execution if a specified exception occurs.

    EXCEPTION HANDLING
  • What is an Exception handling?
    a process used to change the normal flow of code execution if a specified exception occurs.
  • What is a checked exception?
    Exceptions that occur during compilation
  • Exceptions that occur during _______ is called checked exception
    COMPILATION
  • Give the list of Cheked Exceptions
    ClassNotFoundException
    IllegalAccessException
    InstantiationException
    NoSucMethodException
  • The class is not found.
    ClassNotFoundException
  • IllegalAccessException
    Access to a class is denied.
  • ClassNotFoundException
    The class is not found.
  • InstantiationException
    Attempt to create an object of an abstract class or an interface.
  • Attempt to create an object of an abstract class or an interface.
    InstantiationException
  • NoSuchMethodException
    The requested method does not exist.
  • The requested method does not exist.
    NoSuchMethodException
  • exceptions that occur during execution
    Unchecked Exceptions
  • Another term for Unchecked Exceptions
    runtime exceptions
  • What is the difference between checked and unchecked exceptions
    checked exceptions happens during compilation and must be fixed first before running the program. unchecked or runtime exception happens during execution
  • List of unchecked/runtime exception
    ArithmeticException
    ArrayOutOfBoundsException
    ArrayStoreException
    InputMismatchException
    NullPointerException
    NumberFormatException
    StringIndexOutOfBoundsException
  • Arithmetic error, such as an integer divided by 0
    ArithmeticException
  • Accessing an invalid index of the array
    ArrayIndexOutOfBoundsException
  • ArrayIndexOutOfBoundsException

    Accessing an invalid index of the array

  • Assigning a value to an array index that does not match
    the expected data type
    ArrayStoreException
  • 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
  • Entering a value that does not match the expected data
    type
    InputMismatchException
  • Invalid use of a null reference
    NullPointerException
  • NullPointerException
    Invalid use of a null reference
  • Invalid use of a null reference
    NullPointerException
  • NumberFormatException
    Invalid conversion of a string to a numeric format
  • Invalid conversion of a string to a numeric format

    NumberFormatException
  • StringIndexOutOfBoundsException
    Accessing an invalid index (character) of a string
  • Accessing an invalid index (character) of a string

    StringIndexOutOfBoundsException
  • block of code that might throw an exception that can be handled by a matching catch
    block.
    try block
  • a try block is block of code that might throw an exception that can be handled by a matching ______ block.
    catch
  • catch block
    segment of code that can handle an exception that might be thrown by the try block that precedes it.
  • segment of code that can handle an exception that might be thrown by the try block that precedes it.
    catch block
  • method can be used to determine Java’s message about the exception
    getMessage()
  • What is the syntax for getMessage()
    System.out.println(exceptionName.getMessage());
  • True or False: Only one (1) try block is accepted in a program but there can be multiple catch blocks.
    True
  • True or False: There can be multiple try block accepted in a program but there can be only one (1) multiple catch blocks.
    False