集册 Java实例教程 从main抛出异常

从main抛出异常

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

592
从main抛出异常
/**
时 代      J a v a   公   众 号 - nowjava.com
**/

import java.io.FileInputStream;

import java.io.FileNotFoundException;


public class Main {

  public static void main(String[] args) throws FileNotFoundException {

    openFile("C:/test.txt");

  }


  public static void openFile(String name) throws FileNotFoundException {

    FileInputStream f = new FileInputStream(name);

  }

}