Exceptions Excercises



Match up the following.

_____ an object that store information about the occurrence of an unusual or error condition
_____ ArrayIndexOutOfBoundsException, NullPointerException, ArithmeticException, RuntimeException, IOException, FileNotFoundException, NoSuchElementException, NumberFormatException, NegativeArraySizeException, ClassCastException and UnsupportedLookAndFeelException are all examples of this
_____ a subclass of RuntimeException, so it doesn't need to be handled
_____ not a subclass of RuntimeException, so it does need to be handled
_____ one way of handling an exception
_____ the other way of handling an exception
_____ you may catch an exception, and still throw it later
_____ the java keyword for the throws clause
_____ if an exception occurs, and it continues to be thrown by all the methods up to main, and main does not catch it, the your program will
_____ a try catch block uses these two java keywords
_____ a block that surrounds a statement where an exception may be generated (thrown by a method inside that block)
_____ a block that attempts to deal with a thrown exception, should one ever arise
_____ you can have this many catch blocks for a single try block
_____ a block that executes code last, whether or not an exception was ever thrown
_____ the java keyword for the finally block
_____ a finally block always follows this block
_____ in the end, there can be only how many finally blocks for any given try block
a) exceptions
b) finally
c) catch block
d) as many as you like
e) try block
f) checked exceptions
g) true
h) throws
i) crash
j) try and catch
k) declare the exception with a throws clause
l) finally block
m) catch the exception
n) Exception
o) unchecked exceptions
p) a try catch block
q) one