Home  >  Forum  >  Core Java
Post New Query

What is Arithmetic Exception in Java?


joined on
February 03,2015
Asked on February 09,2015
Can anyone please give any example??
joined on
March 15,2013
Replied on February 09,2015

When any number is divided by zero then Arithmetic exception raised. To know more about exception please refer this URL...
http://www.concretepage.com/interview/java-interview/interview-questions-core-java-exceptions-handling

//Arithmetic Exception Example 

package programs;

public class TestEx1 {
public static void main(String[] args) {
int a=20/0;
System.out.println(a);
}

}

joined on
March 15,2013
Replied on February 09,2015

Output of the above example...

Exception in thread "main" java.lang.ArithmeticException: / by zero
at programs.TestEx1.main(TestEx1.java:7)

Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us