Chapter 11 try/catch exception
What is an exception?
An exception is an object that is generated as the result of an error.
AlAll exception classes inherit from the RuntimeException class
False. All exception classes inherit from the THROWABLE class.
An Exception is a String object
False. An exception is an object but it is not a String object.
What is the call stack?
The CALL STACK is an internal list of all the methods that are currently executing.
What does the catch keyword indicate?
The CATCH keyword indicates the TYPE OF EXCEPTION that potentially any statement in the try block can throw.
how are finally blocks different than an else statement
The finally block is always executed after the try block has executed and after any catch blocks have executed. The statements in the finally block execute whether an exception occurs or not.
Exception objects are created from classes in the Java API.
True.
When does the call stack get populated?
When methods are executed and as they are retained in memory.
When and what is placed onto the stack to indicate that it is executing?
When the main routine is invoked, it is placed into/onto the stack to indicate that it is executing.
Can you specify ore than one exception in a catch?
Yes. catch(ExceptionType | ExceptionType2 | ExceptionType3 parameterName)
What is the pseudo equivalent to an else statement when using try-catch?
finally
Each exception object has a _________ named getMessage, that can be used to retrieve the _________ __________ ___________ for the exception.
method, default error message
An exception is an __________ generated in ___________.
object, memory
An exception is an _____________ generated in _____________ as the result of an ___________ or an ______________ ________________.
object, memory, error, unexpected event
If your code does not handle an exception when it is thrown, what deals with it?
the default exception handler
When an exception is generated, it is said to be thrown
true
Write a try and catch blocks
try{ code } catch (ExceptionType parameterName){ (catch block statements...)}