throws Exception from method
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);
}
}
}
http://www.java2s.com/Tutorial/Java/0080__Statement
-Control/Catalog0080__Statement-Control.htm
No comments:
Post a Comment