Friday, November 21, 2014

Why it show exception followed by (hello kkk bye) & Why we use finally ?

public class exception {
    public static void main(String[] args) {
        System.out.println("hello");
        try{ System.out.println("kkk");
            int i = 5/0;
         
        }
        catch(NullPointerException e)
        {
            System.out.println(e);
        }
        finally{
                    System.out.println("bye");
                    }
        System.out.println("no");
        }
    }
 

1 comment: