234k views
4 votes
Which of the following has a method names flush( )?

(a) Input stream
(b) Output Stream
(c) Reader stream
(d) Input reader stream
(e) Input output stream.

User Artemean
by
7.8k points

1 Answer

6 votes

Final answer:

The flush() method is associated with the Output Stream, and it forces buffered output bytes to be written out to the stream.

Step-by-step explanation:

The method named flush() is found in Output Stream. The purpose of this method is to clear the output buffer and force any buffered output bytes to be written out to the stream. When you write data to a stream, the data may not be written to the file or network immediately but may be stored in a buffer. The flush() method is used in situations where it is critical that the buffered data is immediately sent out, such as when you're done writing data or when you're writing time-sensitive data.

User Emschorsch
by
8.4k points