I'd like to show my Console's output in a text file.
public static void main(String [ ] args){
DataFilter df = new DataFilter();
df.displayCategorizedList();
PrintStream out;
try {
out = new PrintStream(new FileOutputStream("C:\\test1.txt", true));
System.setOut(out);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
I get my result correctly on the screen but not result in the textfile ? the test file is genereted but it is empty??