PrintWriter In Java Example
Chapter:
File
Last Updated:
18-07-2016 04:34:14 UTC
Program:
/* ............... START ............... */
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class JavaPrintWriter {
public static void main(String args[]) throws IOException {
PrintWriter pw = new PrintWriter(new FileWriter("out.txt"));
for (int i = 0; i < 10; i++) {
pw.write("something");
}
pw.close();
}
}
/* ............... END ............... */
Notes:
-
The Java.io.PrintWriter class prints formatted representations of objects to a text-output stream.
Tags
PrintWriter, Java