Writing string value to a File - Java File Path IO

Java examples for File Path IO:Text File

Description

Writing string value to a File

Demo Code

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class Main {
  public static void main(String[] args) {
    try {/*from  w w w.j  a v a  2 s  .co m*/
      BufferedWriter out = new BufferedWriter(new FileWriter("outfilename"));
      out.write("aString");
      out.close();
    } catch (IOException e) {
    }
  }
}

Related Tutorials