Question: A-J True or False a. An exception and an error are the same thing. b. An attempt to divide by zero will cause an exception

A-J True or False

a. An exception and an error are the same thing.

b. An attempt to divide by zero will cause an exception to be thrown.

c. If a program does not handle a raised exception, the exception is ignored and nothing happens.

d. If a program does not handle an exception, a message related to the exception will be produced.

e. A call stack trace shows the sequence of method calls that led to the code where an exception occurred.

f. An ArithmeticException is Throwable.

g. An ArithmeticException is a checked exception.

h. A NoSuchMethodException is a checked exception.

i. We can create our own exceptions by extending the Exception class.

j. A throws clause must be appended to the header of a method definition if the method may potentially throw an ArithmeticException.

Multiple choice

6. What output is produced by the following code fragment under each of the stated conditions?

a. No exception is thrown by the review.question() method.

b. An Exception1 exception is thrown by the review.question() method.

c. An Exception2 exception is thrown by the review.question() method.

d. An Exception3 exception is thrown by the review.question() method

{

try

{

review.question();

}

catch (Exception1 exception)

{

System.out.println("one caught");

}

catch (Exception2 exception)

{

System.out.println("two caught");

}

finally

{

System.out.println("finally");

}

}

System.out.println("the end");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets address the True or False questions first True or False a An exception and an error are the same thing False Exceptions and errors are different Exceptions are events that can be handled in a pro... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!