Java FileWriter(String fileName) Constructor
Syntax
FileWriter(String fileName) constructor from FileWriter has the following syntax.
public FileWriter(String fileName) throws IOException
Example
In the following code shows how to use FileWriter.FileWriter(String fileName) constructor.
import java.io.FileWriter;
/*from www . jav a 2s . co m*/
public class Main {
public static void main(String[] args) throws Exception {
FileWriter fileWriter = new FileWriter("c:/abc.txt");
fileWriter.append("java2s.com");
fileWriter.close();
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »