Please check below codes ...
// this will produce java.lang.ArithmeticException: / by zero
System.out.println(1 / 0);
// this will produce Infinity result
System.out.println(1.1 / 0);
I assume Integer arithmetic will always throws java.lang.ArithmeticException: / by zero. If so , I guess the first statement or System.out.println(Integer.parseInt("1") / 0);
should produce compile-time exception. But I didn't get any compile time errors or warnnings on my Eclipse IDE. Or may be I am wrong.
Any suggestions ?