集册 Java实例教程 重新抛出捕获的异常

重新抛出捕获的异常

欢马劈雪     最近更新时间:2020-01-02 10:19:05

417
重新抛出捕获的异常
// 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);

      
展开阅读全文