writing to a file (wrapping)
Hello,
I have been trying the following two ways to create an object to write to a file named "out.txt" :
import java.io.*;
publicclass Test{
publicstaticvoid main(String[] args)throws Exception{
BufferedWriter writer =new BufferedWriter(new PrintWriter(new FileWriter("out.txt")));//WAY 1: WORKS
PrintWriter writer =new PrintWriter(new BufferedWriter(new FileWriter("out.txt")));//WAY 2: WORKS
}
}
It looks like that both ways, tried individually, compile with no errors. Basically I exchange the wrapping betweeing BufferedWriter and PrintWriter. So I wish to ask if one way is considered "correct" over the other, or if there are other subtle differences (perhaps at runtime) that I am not aware of... Many Thanks.

