Understanding BufferedWriter in Java with Examples

When you use BufferedWriter to write, the data gets written to an internal buffer.
Only once the internal buffer is full OR if there is a need to flush, this data gets written to the target character stream/writer.
This buffering approach reduces the (costly) interactions with writing to the network or the disk thereby improving the performance compared to using non buffered writers.