Home Java Example Java Io Java BufferedWriter example

Related Tutorials


 
 

Share on Google+Share on Google+

Java BufferedWriter example

Advertisement
This is tutorial of Java BufferedWriter with example code.

Write a File using BufferedWriter

    

Write a File using BufferedWriter

In this section, you will learn how to write to a file using BufferedWriter.

What is BufferedWriter?

BufferedWriter buffer character to write characters, arrays and strings. It write text to a character-output stream.

Given below example will give you a clear idea :

Example :

import java.io.*;

public class FileWriteBufferedWriter {
public static void main(String[] args) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter(
"NewDevFile.txt"));
out.write("Welcome to Devmanuals");
out.close();
System.out.println("File created successfully");
} catch (IOException e) {
}
}
}

Output

If file created successfully, it will show you the following message :

File created successfully    

Download Source Code

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 19, 2011

Related Tutorials

Discuss: Java BufferedWriter example  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com