Advertisement
Advertisement
class Exp
{
public static void main(String... ar)
{
Exp ob = new Exp();
ob.method1();
}
public void method1()
{
method2();
}
public void method2()
{
method3();
}
public void method3()
{
System.out.println(100/0); //ArithmeticException is raised/thrown by the program.
System.out.println("Hello"); //This statement will not be executed.
}
}
Exception in thread "main" java.lang.ArithmeticException: / by zero
at Exp.method3(Exp1.java:23)
at Exp.method2(Exp1.java:17)
at Exp.method1(Exp1.java:12)
at Exp.main(Exp1.java:6)
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement