throws Exception from method : throws signature « Statement Control « Java Tutorial
- Java Tutorial
- Statement Control
- throws signature
class ThrowsDemo {
static void throwOne() throws IllegalAccessException {
System.out.println("Inside throwOne.");
throw new IllegalAccessException("demo");
}
public static void main(String args[]) {
try {
throwOne();
} catch (IllegalAccessException e) {
System.out.println("Caught " + e);
}
}
}
4.13.throws signature |
| 4.13.1. | throws Exception from method |