Hey friends this code explains a simple example of using bufferedwriter in Java:
Writer.java:
import java.io.*;
class Bufferedwriter {
 public static void main(String args[]) throws IOException
 {
  String s="Hello this information is written to file using filewriter\nIt is used for writting";
  FileWriter f=new FileWriter("File1.txt");
  char b[]=new char[s.length()];
  s.getChars(0,s.length(),b,0);
  BufferedWriter bw=new BufferedWriter(f);
  bw.write(b);
  f.close();
  System.out.println("Data Successfully Written");
 }
} 
Have Funs..............

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.