q-13 how to throw the exception explicitly?
class Test
{
public static void main(String[] args) {
explicitlyCall();
}
public static void explicitlyCall()
{
try
{
ArithmeticException ae=new ArithmeticException("ArithmethicException");
throw ae;
}
catch(ArithmeticException ae)
{
ae.printStackTrace();
}
}
}
class Test
{
public static void main(String[] args) {
explicitlyCall();
}
public static void explicitlyCall()
{
try
{
ArithmeticException ae=new ArithmeticException("ArithmethicException");
throw ae;
}
catch(ArithmeticException ae)
{
ae.printStackTrace();
}
}
}
No comments:
Post a Comment