Created
October 17, 2017 14:09
-
-
Save javamultiplex/4fc69105a22a53cb50a658c5d601af83 to your computer and use it in GitHub Desktop.
Example of ArithmeticException present in java.lang package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javamultiplex.java.lang.exceptions; | |
/** | |
* @author Rohit Agarwal | |
* @version 1.0 | |
* @category java.lang/Exception | |
* @since JDK 1.0 | |
*/ | |
public class ArithmeticExceptionDemo { | |
public static void main(String[] args) { | |
int a = 24; | |
int b = 0; | |
/* | |
* ArithmeticException will be thrown because we are dividing | |
* numerator(a) with denominator zero(b). | |
*/ | |
int c = a / b; | |
System.out.println(c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment