Java Reference
In-Depth Information
11 . What are the three ways that an exception can be generated?
An exception can be generated by an error in the JVM, by an error in your program,
or explicitly via a throw statement.
12 . What are the two direct subclasses of Throwable ?
Error and Exception
13 . What is the multi-catch feature?
The multi-catch feature allows one catch clause to catch two or more exceptions.
14 . Should your code typically catch exceptions of type Error ?
No.
Chapter 10: Using I/O
1 . Why does Java define both byte and character streams?
The byte streams are the original streams defined by Java. They are especially useful
for binary I/O, and they support random-access files. The character streams are op-
timized for Unicode.
2 . Even though console input and output is text-based, why does Java still use byte
streams for this purpose?
The predefined streams, System.in , System.out , and System.err , were defined be-
fore Java added the character streams.
3 . Show how to open a file for reading bytes.
Here is one way to open a file for byte input:
4 . Show how to open a file for reading characters.
Here is one way to open a file for reading characters:
5 . Show how to open a file for random-access I/O.
Here is one way to open a file for random access:
Search WWH ::




Custom Search