Java tutorial
/* * Output: * Exception in thread "main" java.lang.IllegalAccessException: demo caught inside procedure at MainClass.main(MainClass.java:12) * * */ public class MainClass { public static void main(String args[]) throws Exception { System.out.println("caught inside procedure"); throw new IllegalAccessException("demo"); } }