既然PrintWriter已经自带缓冲功能,为什么还要把BufferedWriter包装起来用?
这是API给的建议写法: PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
请问既然PrintWrite已经能自带缓冲了,为什么还要包装一个缓冲流?
如果写成: PrintWriter out = new PrintWriter(new FileWriter("foo.out")); 这样在性能上有什么区别?