Throws


public class ThrowsDemo {
    public static void main(String[] argsthrows FileNotFoundException, IOException{
        File f=new File("D:/MyFile.txt");
        FileInputStream in=new FileInputStream(f);  /*FileNotFoundException will be thrown here
                                                      if there is no file at the location specified*/
        BufferedReader br=new BufferedReader(new InputStreamReader(in));
        System.out.println(br.readLine());          /* IOException will be thrown here when reading from file is failed*/
    }

}

Output:
Exception in thread "main" java.io.FileNotFoundException: D:MyFile.txt (The system cannot find the file specified)