Download java eBook


  • new BufferedWriter(Writer); //The default constructor
  • BufferedWriter.write(int c); //Writes a single character
  • BufferedWriter.write(String str); //Writes a string
  • BufferedWriter.newLine(); //Writes a line separator
  • BufferedWriter.close(); //Closes the BufferedWriter


  • If you try to write from a BufferedWriter (using BufferedWriter.write()) after closing the BufferedWriter (using BufferedWriter.close()), it will throw an IOException.
  • The BufferedWriter(Writer) constructor does NOT throw an IOException. However, the FileWriter(File) constructor throws a FileNotFoundException, which extends IOException. So catching IOException will also catch FileNotFoundException, there is never a need for a second catch statement unless you plan on doing something different with the FileNotFoundException.

Related Examples


86 Contributors: 5
Saturday, September 24, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook