Difference between flush and close in java filewriter

By | June 9, 2020

What is the difference between flush and close in java filewriter:

flush() writes the contents of the buffer to the destination and makes the buffer empty for further data to store but it does not close the stream permanently. This means we can still write some more data to the stream.

Whereas close() closes the stream permanently. If you want to write some additional data, then you have to re-open the stream and append the data with the existing one.

 

Recommended Posts:

Star pattern programs in Java

String split function

Real-time selenium interview questions

Top 25 selenium interview questions

Java interview questions – p1

How to remove last element from an ArrayList

 

Tags: flush and close in java

This article has been published by Chandra Sekhar. If you like selenium99 website and want to contribute any articles then please share your articles at techygeeks99@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *