1> Do close() and flush() performs the same function??
2> Why their is no output when i do not write the pw.close() or pw.flush() ?
Oh It means close performs both the function of flushing and then closing.
That means close() will save writing flush() if we want to close the file directly
Hi Brij,
I also checked by writing on close() method then also it write the data into the given file. It means it is also performing some sort of flush() function before closing
Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.