Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //class SimpleException
- package p1;
- public class SimpleException extends Exception{
- }
- //class InheritingException
- package p1;
- public class InheritingException {
- public void f() throws SimpleException
- {
- System.out.println("Exceptie SE");
- throw new SimpleException();
- }
- public static void main(String[] args)
- {
- InheritingException ex=new InheritingException() ;//....
- try
- {
- ex.f();
- }
- catch(SimpleException e)
- {
- System.out.println("Caught it");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement