VOOZH about

URL: https://www.geeksforgeeks.org/java/bufferedwriter-close-method-in-java-with-examples/

⇱ BufferedWriter close() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

BufferedWriter close() method in Java with Examples

Last Updated : 28 May, 2020
The close() method of BufferedWriter class in Java is used to flush the characters from the buffer stream and then close it. Once the stream is closed further calling the methods like write() and append() will throw the exception. Syntax:
public void close()
Parameters: This method does not accept any parameter. Return value: This method does not return any value. Exceptions: This method throws IOException if an I/O error occurs. Below programs illustrate close() method in BufferedWriter class in IO package: Program 1:
Output:
GEEKS
Program 2:
Comment
Article Tags:
Article Tags: