How can you assign program output to a file, rather than to the standard output device? Explain how this works. Give an example.

What will be an ideal response?


Instead of assigning the standard output device to OutputStream, you can assign a file. To accomplish this, you can construct a BufferedOutputStream object and assign it to the OutputStream. If you want to change an application's output device, you don't have to modify the application other than to assign a new object to the OutputStream; the rest of the logic remains the same. Java lets you assign a file to a Stream object so that screen output and file output work in exactly the same manner.

Computer Science & Information Technology

You might also like to view...

_________________ argued that there is a right to privacy that is separate from property rights and contractual obligations.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

One of the most common and alarming mistakes when saving documents is:

A) saving it and then closing the document. B) saving it, and not being aware of the location. C) saving it in a wrong version. D) saving it in the wrong font.

Computer Science & Information Technology

Clicking on the ________ displays sheet tabs that are not in view.

a. sheet tab scrolling button b. Name Box c. expand horizontal scroll bar button d. Formula Bar

Computer Science & Information Technology

The AutoCorrect feature can automatically capitalize the first letter in the names of days.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology