Sunday, 6 July 2014

Excetion Propagation (Stack Trace)

class Propagation
{
    void show() throws Exception
    {
        int a = 10/0;            //    unchecked exception
    }
    void disp() throws Exception
    {
        show();
    }
    public static void main(String...s)
    {
        Propagation ob = new Propagation();                // this concept is known as object propagation.
        try
        {
            ob.disp();
        }
        catch(Exception e)
        {
            System.out.println(e);
            e.printStackTrace();
            System.out.println(e.getMessage());
        }

    }
}

No comments:

Post a Comment