What is Arithmetic Exception in Java?

Asked on February 09, 2015
Can anyone please give any example??

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...

//Arithmetic Exception Example 

package programs;

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


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

©2024 concretepage.com | Privacy Policy | Contact Us