Prev | Current Page 237 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

Following the try block can be multiple
catch blocks and a finally block. Catch blocks can specify which subclasses of Exception they
will handle. Code in a finally block will always be executed, whether an error occurs in the try block or not.
If the application does not catch an Exception, the Exception will propagate up to the JVM, which will
handle the Exception by reporting it and terminating the program.
Input and output in Java occurs using streams. A stream is a sequence of data elements. The many types of
streams available in Java can be classified into Input/OutputStreams, which handle raw binary data as
bytes, and Reader/Writer streams which handle character data, and automatically perform translations to and
from character encodings. For efficiency, good programming practice is to wrap a base stream object in a
buffered stream to provide efficient buffering of I/O.
The Scanner class in Java is a handy class for reading text from the keyboard, a file, or other input stream.
The PrintWriter class is another convenience class that facilitates the common task of writing formatted
text to a file.
REVIEW QUESTIONS
5.1 Write a Java program that divides the number 74.3 by 12.6 and reports the result of the division.


Pages:
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
apartamenty przy plaży tanie noclegi nad morzem rewal producent sal zabaw przyczepy campingowe Wynajem osuszaczy Kraków