File size: 380 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import java.io.*;
class N {
void method() throws IOException {
throw new IOException("device error");
}
}
/**
* Case2: You declare the exception
*/
public class ThrowsExample2 {
public static void main(String[] args) throws IOException {// declare exception
N n = new N();
n.method();
System.out.println("normal flow...");
}
}
|