Advertisement
Adytzu04

l2p2 -java

Mar 16th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. //class SimpleException
  2. package p1;
  3.  
  4. public class SimpleException extends Exception{
  5.  
  6. }
  7.  
  8. //class InheritingException
  9.  
  10. package p1;
  11.  
  12. public class InheritingException {
  13.     public void f() throws SimpleException
  14.     {
  15.         System.out.println("Exceptie SE");
  16.         throw new SimpleException();
  17.        
  18.     }
  19.  
  20. public static void main(String[] args)
  21. {
  22.     InheritingException ex=new InheritingException() ;//....
  23.     try
  24.     {
  25.         ex.f();
  26.     }
  27.     catch(SimpleException e)
  28.     {
  29.         System.out.println("Caught it");
  30.     }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement