Integer division will generate an ArithmeticException when attempting to divide by zero. : Arithmatic Operators « Operators « SCJP






public class MainClass{
    public static void main(String[] argv){
       int i = 9;
       int j = 0;
       int z = i/j;
       System.out.println(z);

    }
}
Exception in thread "main" java.lang.ArithmeticException: / by zero
	at MainClass.main(MainClass.java:5)








2.5.Arithmatic Operators
2.5.1.Arithmetic Operator Summary
2.5.2.The * and / operators perform multiplication and division on all primitive numeric types and char.
2.5.3.Integer division will generate an ArithmeticException when attempting to divide by zero.
2.5.4.Multiply can cause overflow.
2.5.5.Divide can cause underflow.
2.5.6.Integer Division and Division by Zero
2.5.7.Division of an integer by zero results in the throwing of an ArithmeticException.
2.5.8.A positive floating-point value / zero results = POSITIVE_INFINITY.
2.5.9.A negative floating point value / zero = NEGATIVE_INFINITY.
2.5.10.Modulo Operations: x % y = x - ((int) (x/y)*y).
2.5.11.Java allows floating-point operands to be used with the % operator.
2.5.12.The Modulo Operator % gives the remainder of a division.
2.5.13.Apply Modulo Operator % to floating-point numbers
2.5.14.Apply Modulo Operator % to negative numbers
2.5.15.Apply Modulo Operator %, what if the second operand is 0
2.5.16.Overflow and Underflow
2.5.17.+ operator is overloaded by the Java language for String
2.5.18.Number types get converted when plusing to a string
2.5.19.Conversion to a String object is performed by invoking the toString() method of that object.
2.5.20.String concatenation gets interesting when you combine numbers with Strings