我的问题是关于行(编辑:19),其中新的PrintWriter是用构造函数以FileWriter fw作为参数创建的。我不明白如果在实际写作中没有使用将BufferedWriter bw链接到FileWriter的用法。 Java能否以某种方式影响程序的其余部分来应用链接?SCJP书,IO部分:这是一个错字还是有一个它看起来像这样的原因?
16. try {
17. FileWriter fw = new FileWriter(test);
18. BufferedWriter bw = new BufferedWriter(fw, 1024);
19. PrintWriter out = new PrintWriter(fw);
20. out.println("<html><body><h1>");
21. out.println(args[0]);
22. out.println("</h1></body></html>");
23. out.close();
24. bw.close();
25. fw.close();
26. }catch(IOException e) {
27. e.printStackTrace();
28. }
我认为这可能是一个错字,他们想用的体重为PrintWriter的参数了,但就像标题所说,我是新来这。
感谢所有提前。
这几乎可以肯定是一个错字,虽然它似乎没有在[官方勘误](http://books.mcgraw-hill.com/downloads/products/0072253606/0072253606_errata0504.txt)。 – 2010-05-14 18:37:33