Thursday, February 26, 2009

source code defaultexceptionhandler



// Example to demonstrate Default exception handler
package exceptions;

public class De
{
public static void main(String a[])
{
doStuff();
}
public static void doStuff()
{
doMoreStuff();
}
public static void doMoreStuff()
{
System.out.println("hai");
System.out.println(10/0); // get exception here
// if we are not keeping try,catch blocks
//default exception handler will take care to print exception stack
}
}


0 comments:

Post a Comment