Bapa

Untitled

Mar 17th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. public class ThrowsDemo
  2. {
  3.       static void throwMethod()
  4.   {
  5.               System.out.println("Inside throwMethod.");
  6.               throw new IllegalAccessException("demo");
  7.       }
  8.  
  9.       public static void main(String args[])
  10.   {
  11.            try
  12.                                           {
  13.                  throwMethod();
  14.            }
  15.                                           catch (IllegalAccessException e)
  16.                               {
  17.                  System.out.println("Caught " + e);
  18.            }
  19.        }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment