Stack-Repo
/
data
/train
/akash-coded
/FSD_Java
/Lesson-3
/Exception Handling
/Examples
/ThrowsExample2.java
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..."); | |
} | |
} | |