![]() |
In Java programming, the java.lang.ArithmeticException is an unchecked exception of arithmetic operations. This means you try to divisible by zero, which raises the runtime error. This error can be handled with the ArthmeticException. ArithmeticException can be defined as a runtime exception that can occur during an arithmetic operation due to the exceptional condition. ArithmeticException is part of the java.lang package. In this article, we will learn how to handle a java.lang.ArithmeticException in Java. Syntax:try { Program to Handle a java.lang.ArithmeticException in JavaLet us understand programmatically, to handle a java.lang.ArithmeticException. Java
Output
ArithmeticException occurred: / by zero This is the example of the ArithmeticException Explanation of the above Program:
|
Reffered: https://www.geeksforgeeks.org
Java |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |