69.throw keyword in java
//throw keyword
class throw1
{
public static void main(String[] args) {
try
{
//ArithmeticException obj = new ArithmeticException();
//throw obj;
throw new ArithmeticException();
}
catch(ArithmeticException ae)
{
System.out.println("Exception Caught");
}
catch(Exception e)
{
System.out.println("Exception : " + e);
}
}
}
OUTPUT:
Exception Caught
Comments
Post a Comment