CPS 181-Chapter 11 Review

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

In a multi-catch (introduced in Java 7) the exception types are separated in the catch clause by the ________ symbol.

|

A(n) ________ is a section of code that gracefully responds to exceptions when they are thrown.

Exception Handler

T/F When an object is serialized, it is converted into a series of bytes that contain the object's data.

False

T/F If the class SerializedClass contains references to objects of other classes as fields, those classes must also implement the Serializable interface in order to be serialized.

True

An exception object's default error message can be retrieved using the ________ method.

getMessage

Beginning with Java7, to catch multiple exceptions with a single catch, you can use ________.

multi-catch

The IllegalArgumentException class extends the RuntimeException class and is, therefore, ________.

An unchecked exception class

A file that contains raw binary data is known as a ________.

Binary File

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 the ________ class.

Exception

All exceptions are instances of classes that extend the ________ class.

Throwable

A(n) _______ contains one or more statements that are executed and can potentially throw an exception.

Try block

To serialize an object and write it to the file, use the ________ method of the ObjectOutputStream class.

WriteObject

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

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

If a method does not handle a possible checked exception, what must the method have?

a throws clause in its header

If your code does not handle an exception when it is thrown, ________ prints an error message and crashes the program.

Default Exception Handler

To read data from a binary file, you create objects from which of the following classes?

FileInputStream and DataInputStream

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

Handles the Exception and has a throws clause listed in the method header

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

It prints the error message for an exception

When you write a method that throws a checked exception, you must ________.

Have a throws clause in the method header or handle the exception (e.g. using try-catch)

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.

T/F In a try statement, the try clause must appear first, followed by all of the catch clauses, followed by the optional finally clause

True

T/F The call stack is an internal list of all the methods that are currently executing

True

T/F When an exception is thrown by a method that is executing under several layers of method calls, a stack trace indicates the method executing when an exception occurred and all of the methods that were called in order to execute that method

True

T/F When an object is serialized, it is converted into a series of bytes that contain the object's data.

True

T/F When you deserialize an object using the readObject method, you must cast the return value to the desired class type.

True

T/F: A class must implement the Serializable interface in order for the objects of the class to be serialized.

True


Set pelajaran terkait

Chapter 6 - Violence in Sports - TF

View Set

Python If, Elif, while, for, break, continue, pass)

View Set

Perguntas iguais! Chapter 4 and 3 end of chapter review & lecture notes

View Set

CH 4: Completing the Accounting Cycle

View Set

Foundations Chapter 9 Cultural Awareness

View Set

Chapter 7: Optimal Risky Portfolios (Review Questions)

View Set

Research Methods Test 3 Study Guide

View Set