Skip to content

Instantly share code, notes, and snippets.

@javamultiplex
Created October 17, 2017 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javamultiplex/4fc69105a22a53cb50a658c5d601af83 to your computer and use it in GitHub Desktop.
Save javamultiplex/4fc69105a22a53cb50a658c5d601af83 to your computer and use it in GitHub Desktop.
Example of ArithmeticException present in java.lang package
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