ITP 120 CHAPTER 11

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

If, within one try statement you want to have catch clauses of the following types, in which order should they appear in your program:(1) Exception(2) IllegalArgumentException(3) RuntimeException(4) Throwable

2, 3, 1, 4

If, within one try statement you want to have catch clauses that catch exceptions of the following types, in which order should they appear in your program?(1) Throwable(2) Exception(3) RuntimeException(4) NumberFormatException

4, 3, 2, 1

In a catch statement, what does the following code do?System.out.println(e.getMessage());

It prints the error message for an exception

The exception classes are in packages in the ________.

JAVA API

The numeric classes' "parse" methods all throw an exception of this type if the string being converted does not contain a convertible numeric value.

NumberFormatException

The catch clause:

contains code to gracefully handle the exception type listed in the parameter list starts with the word catch followed by a parameter list in parentheses containing an ExceptionType parameter variable follows the try clause

If the code in a method can potentially throw a checked exception, then that method must:

either handle the exception or have a throws clause listed in the method header

A(n) ________ is an object that is generated in memory as the result of an error or an unexpected event.

exception

All of the exceptions that you will handle are instances of classes that extend this class.

exception

The try statement may have an optional ________ clause, which must appear after all of the catch clauses.

finally

Classes that inherit from the Error class are:

for exceptions that are thrown when a critical error occurs, and the application program should not try to handle them

An exception's default error message can be retrieved using this method.

getMessage()

The following catch statement can:catch (Exception e) {...}

handle all exceptions that are instances of the Exception class or a subclass of Exception

The ability to catch multiple types of exceptions with a single catch is known as ________, and was introduced in Java 7.

multi-catch

When an exception is thrown by code in the try block, the JVM begins searching the try statement for a catch clause that can handle it and passes control of the program to:

the first catch clause that can handle the exception.

If the program does not handle an unchecked exception:

the program is halted and the default exception handler handles the exception

In a try/catch construct, after the catch statement is executed:

the program resumes at the statement that immediately follows the try/catch construct

All exceptions are instances of classes that extend this class.

throwable

In a multi-catch, (introduced in Java 7) the exception types are separated in the catch clause by this symbol:

|


संबंधित स्टडी सेट्स

Microbiology Test 1 Chapter 1,2,3

View Set

Chapter 2 - Global, ethical, and sustainable marketing

View Set

Accounting: Manufacturing Overhead

View Set