• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/8

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

8 Cards in this Set

  • Front
  • Back
What is an Exception?
An Exception is an abnormal condition or an error that arises in a code sequence at run time.
What are the three blocks in an Exception handler?
Try, catch and finally.
Explain the throw keyword used in an exception block?
Throw is used to generate an Exception.
What are the two possible sources of Exceptions?
Exceptions can be thrown by the Java run time system or can be generated programmatically by a piece of code.
What is "Catch or Specify" as it pertains to Exceptions?
This means that either an Exception must be caught or the method in which the Exception is generated must specify that it can throw such an Exception. Any subclass of Exception that isn't also a subclass of RuntimeException is subject to "Catch or Specify".
What are the three types of exceptions in Java?
1. Checked Exceptions which are of the sort that an well written program can anticipate and recover from. FileNotFoundException for example.
2. Errors which are of the sort that are external to the system and are probably un-recoverable.
3. Runtime exceptions which are of the sort that are internal to the system and probably unrecoverable. ArithmeticException such as in the case of a divide by zero, IndexOutOfBoundsException and NullPointerException are examples.
What are some advantages of exception handling?
1. Separates error handling code from regular code.
2. Propagation of errors up the call stack which allows a method's caller to handle it.
3. Grouping and differentiating error types.
You have an Exception handling block that has a try block and a finally block. You call System.exit(0); inside the try block. Will the finally block get called?
No. System.exit() does not return. It terminates the JVM.