esnoopy808
esnoopy808

Reputation: 27

PrintWriter not working, but PrintStream is

I'm trying to print some characters to an output file. If I do:

PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.txt")));

out.println("Hi");

nothing happens.

However, if I do: PrintStream out = new PrintStream(new File("test.txt")); out.println("Hi");

the appropriate message is printed and visible in the test.txt file. I'm wondering why this is happening??

Upvotes: 1

Views: 45

Answers (0)

Related Questions