Why doesn't Java treat explicit division by zero as a compile-time exception?

44 Views Asked by At

Why is explicit division By zero not considered as compile time exception in JAVA ?

Example :

int x =9; int y = (int)x/0;

Shouldnt compiler notify me about it ?

I tried running the same and finding answers to it , I am not convinced that why is that a checked exception. Divinding by another variable has to be runtime , agreed. But explicit division by ) shoukd be at compile time.

0

There are 0 best solutions below