- Shuffle
Toggle OnToggle Off
- Alphabetize
Toggle OnToggle Off
- Front First
Toggle OnToggle Off
- Both Sides
Toggle OnToggle Off
Front
How to study your flashcards.
Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key
Up/Down arrow keys: Flip the card between the front and back.down keyup key
H key: Show hint (3rd side).h key
![]()
PLAY BUTTON
![]()
PLAY BUTTON
![]()
11 Cards in this Set
- Front
- Back
|
Advantages of Java's exception handling technique
|
1) can handle all types of exceptions
2) Handles situations the system cannot recover from |
|
try-throw-catch explained
|
The basic way of handling exceptions in Java
First a try block contains all the code that should run and may contain exceptions. When there is an exception, the throw operator is used which sends the code to the catch block, which contains the code for handling the exceptions |
|
Finally block
|
the finally block contains all code that should be run whether an exception is thrown or not. It would normally contains processes such as closing files and clearing screens.
|
|
Catch block order
|
Catch blocks should be put in the correct order, from most specific to most general, so that the wrong catch is not done. The catch blocks are examined in the order they are written.
|
|
Catch or Declare Rule
|
Exceptions must be taken care of by either throwing an exception and catching it with a catch block or declaring an exception and using a throws clause.
|
|
Checked Exception
|
A checked exception is any exception that is subject to the Catch or Declare Rule. The compiler will check to make sure they are accounted for. The throwable and exception classes are checked.
|
|
Unchecked Exception
|
Any exceptions not subject to the Catch or Declare Rule. The error and RunTime exception classes are unchecked.
|
|
Defining your own exception class
|
Must be derived from the exception class.
Needs at least two constructors Must preserve the getMessage method |
|
Common RunTime errors
|
ArrayIndexOutofBounds
NullPointerException TypeMismatchException |
|
Throws Clause
|
A throws clause is when an exception is thrown but not caught, so a warning must be given by declaring an exception. It is needed when you do not use a try catch throw block because all exceptions must be accounted for by the Catch or Declare Rule.
|
|
Exceptions that are not Caught
|
In GUI based programs: nothing happens
In non GUI based programs: the program terminates with an error naming the exceptions |