Advertisement
brandblox

java lab 01 (06/11/2023)

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