重新抛出捕获的异常
// from n o w j a v a . c o m - 时 代 Java import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.concurrent.LinkedBlockingQueue; public class Main { public static void main(String[] args) { try { doSomeWork(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } private static void doSomeWork() throws IOException, InterruptedException { LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<>(); try { FileOutputStream fos = new FileOutputStream("out.log"); /** 来自 n o w j a v a . c o m - 时 代 Java**/ DataOutputStream dos = new DataOutputStream(fos);