Save to a text File with PrintStream in Java
Description
The following code shows how to save to a text File with PrintStream.
Example
//from www . j a va 2s. co m
import java.io.FileOutputStream;
import java.io.PrintStream;
public class Main {
public static void main(String[] a) throws Exception {
PrintStream out = new PrintStream(new FileOutputStream("OutFile.txt"));
out.println("demo from java2s.com");
out.close();
}
}