14

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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 ParseIntError ExceptionMessage FileNotFoundException

numberformatexception

The ability to catch multiple types of exceptions with a single catch is known as ________, and was introduced in Java 7. multi-catch super catch exception trapping compound catch

multi-catch

All exceptions are instances of classes that extend this class. RunTimeException Throwable Error Exception

throwable

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

|

What will the following code display? 99 997 0 1

0

Classes that inherit from the Error class are: a) for exceptions that are thrown when a critical error occurs, and the application program should not try to handle them b) for exceptions that are thrown when a critical error occurs, and the application program should try to handle them c) for exceptions that are thrown when an IOException occurs, and the application program should not try to handle them d) for exceptions that are thrown when an IOException error occurs, and the application program should try to handle them

a

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 a) 4, 3, 2, 1 b) 2, 3, 1, 4 c) 4, 1, 3, 2 d) 3, 1, 2, 4

a

If the program does not handle an unchecked exception: a) the exception is ignored b) the program is halted and the default exception handler handles the exception c) the program must handle the exception d) this will cause a compilation error

b

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 a) 1, 2, 3, 4 b) 2, 3, 1, 4 c) 4, 1, 3, 2 d) 3, 1, 2, 4

b

In a catch statement, what does the following code do?System.out.println(e.getMessage()); a) It prints the stack trace. b) It prints the error message for an exception. c) It prints the code that caused the exception. d) It overrides the toString method.

b (It prints the error message for an exception.)

If the code in a method can potentially throw a checked exception, then that method must: a) handle the exception b) have a throws clause listed in the method header c) neither handle the exception nor have a throws clause listed in the method header d) either handle the exception or have a throws clause listed in the method header

d

The catch clause: a)follows the try clause b)starts with the word catch followed by a parameter list in parentheses containing an ExceptionType parameter variable c)contains code to gracefully handle the exception type listed in the parameter list d)All of these

d (all of the above)

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

exception

All of the exceptions that you will handle are instances of classes that extend this class. RunTimeException IOException Error Exception

exception

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

finally

An exception's default error message can be retrieved using this method. getMessage() getErrorMessage() getDefaultMessage() getDefaultErrorMessage()

getMessage()

The exception classes are in packages in the ________. Java API JVM Compiler Ex class

java api

The following catch statement can: catch (Exception e) {...} a) handle all exceptions that are instances of the Exception class, but not a subclass of Exception b) handle all throwable objects by using polymorphic reference as a parameter in the catch clause c) handle all exceptions that are instances of the Exception class or a subclass of Exception d) is an error since no objects are instantiated in the Exception class

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

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: a)each catch clause that can handle the exception. b)the last catch clause that can handle the exception. c)the first catch clause that can handle the exception. d)If there are two or more catch clauses that can handle the exception, the program halts.

c (the first catch clause that can handle the exception.)

In a try/catch construct, after the catch statement is executed: a)the program returns to the statement following the statement in which the exception occurred b) the program terminates c) the program resumes at the statement that immediately follows the try/catch construct d) the program resumes at the first statement of the try statement

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


Set pelajaran terkait

Investigating God's World Chapter 7 Test

View Set

S-130 Module 1 (Preparedness, ICS, & Resources)

View Set

Social Studies, Chapter 16 Lesson 2

View Set

MYM 6.1a: Factors that Influence Buying Decisions

View Set

Budgets and Balance Sheets PERSONAL FINANCE

View Set