Java FileWriter(String fileName, boolean append) Constructor

Syntax

FileWriter(String fileName, boolean append) constructor from FileWriter has the following syntax.

public FileWriter(String fileName,   boolean append)   throws IOException

Example

In the following code shows how to use FileWriter.FileWriter(String fileName, boolean append) constructor.


/*  w  ww. j  a  v  a 2s .  co  m*/
import java.io.FileWriter;

public class Main {
  public static void main(String[] args) throws Exception {
    FileWriter fileWriter = new FileWriter("c:/abc.txt",true);
    fileWriter.append("java2s.com");
    fileWriter.close();
    
  }
}