Datasets:

ArXiv:
License:
File size: 656 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.io.*;

class M {
    void method() throws IOException {
        throw new IOException("device error");

        // try {
        // throw new IOException("device error");
        // } catch (IOException ex) {
        // System.out.println("Caught inside M class" + ex);
        // }
    }
}

/**
 * Case1: You handle the exception
 */
public class ThrowsExample1 {
    public static void main(String args[]) {
        try {
            M m = new M();
            m.method();
        } catch (Exception e) {
            System.out.println("exception handled inisde main method");
        }

        System.out.println("normal flow...");
    }
}