Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class excp{
- public static void main(String args[]){
- int a,b,c;
- try{
- a=0 ; b=10 ;
- c = b/a;
- System.out.println("This line won't be executed");
- }
- catch(ArithmeticException e)
- {
- System.out.println("Divide by zero");
- }
- System.out.println("After exception is handled");
- }
- }
- /*
- Output
- */
- class throoo{
- static void check() throw ArithmeticException{
- System.out.println("Inside check function");
- throw new ArithmeticException("Demo");
- }
- public static void main(String args[]){
- try
- check();
- catch(ArithmeticException c)
- System.out.println("Caught "+c);
- }
- }
- // Ouput : not working
Add Comment
Please, Sign In to add comment