Skip to content
Advertisement

Java division by zero doesnt throw an ArithmeticException – why?

Why doesn’t this code throw an ArithmeticException? Take a look:

JavaScript

I have no idea!

Advertisement

Answer

Why can’t you just check it yourself and throw an exception if that is what you want.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement