I specifically print out the result : System.out.println("f/c = " + f/c); //f/c = Infinity , where f is double but this will get ArithmeticException : System.out.println("d/c = " + d/c); // ArithmeticException : / by zero , where d is long Why there is a difference? Why both of them throw ArithmeticException?