0
点赞
收藏
分享

微信扫一扫

《Java编程思想第四版》学习笔记28

止止_8fc8 2023-09-15 阅读 8

//: PrintFile.java
// Shorthand class for opening an output file
// for human-readable output.
package com.bruceeckel.tools;
import java.io.*;
public class PrintFile extends PrintStream {
 public PrintFile(String filename)
 throws IOException {
 super(
 new BufferedOutputStream(
 new FileOutputStream(filename)));
 }
 public PrintFile(File file)
 throws IOException {
 this(file.getPath());
 }
} ///:~

注意构建器不可能捕获一个由基础类构建器“掷”出的违例。

                                                                                                                                                           P.299

注意上面这一句话!

举报

相关推荐

0 条评论