Question
Match the following terms to the definition below. Note that there are more terms than definitions. -assert -ae| ; , all AutoClosable catch caught checked
Match the following terms to the definition below. Note that there are more terms than definitions.
-assert
-ae|
;
,
all
AutoClosable
catch
caught
checked
close
Error
Exception
only the first
optional
required
Resource
stack trace
start point
throw point
Throwable
try
uncaught
unchecked
unwound
wound
wrapped
Which term from the above word bank matches each description below?
In multi-catch, each exception type is separated by ____.
To enable assertions at runtime, use the ____ switch when running the java command .
Subclasses of RuntimeException represent _______ exceptions.
An exceptions _____ includes the name of the exception in a message that indicates the problem that occurred and the complete method-call stack.
Each resource of a try-with-Resources statement must be an object of a class that implements the __ interface..
If there are multiple matching catch blocks when an exception occurs, ___ is/are executed
An ____ exception is an exception that occurs for which there are no matching catch blocks.
The point in the program at which an exception occurs is called the _____.
The finally block is ______.
A ____ block encloses code that might throw an exception and code that should not execute if that exception occurs.
Class Throwable has two direct subclasses: Exception and _____.
When an exception is thrown but not caught, the method-call stack is _____, and an attempt is made to catch the exception in the next outer try statement
Answer the following question based on the following class:
public class SomeClass
{
public static void main(String[] args)
{
try
{
fun1();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void fun1() throws Exception
{
fun2();
}
public static void fun2() throws Exception
{
throw new Exception("In fun2");
}
)
What is the stack trace printed by the catch block? (Make sure you include all of the lines class names, method names, and line numbers)
If you want to catch RuntimeException, IndexOutOfBoundsException, and ArrayOutOfBoundsException, what order you write the catch blocks?
When does the finally block get executed? Address both when an exception occurs and when an exception does not occur.
Are there any instances when a finally block does not execute?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started