Source code
package com.t4b.test;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
public class PrintStreamTest {
public static void main(String[] args) {
try {
FileOutputStream fout = new FileOutputStream("test.txt");
PrintStream pout = new PrintStream(fout);
pout.println(100);
pout.println("Hello World");
pout.close();
fout.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.