The
Java spec spells out which specific errors are flagged at compile time. Type safety, uninitialized variables, ambiguous member selection, and narrowing casts are examples.
Sometimes javac looks at literal values, such as in "byte b1 = 1;", which is allowed even though "1" is an int because javac knows that "1" will fit in a byte. javac may even do the arithmetic with literals at compile time, so "byte b3 = 2 / 1;" is allowed but "byte b3 = 1 + 1000;" and "byte b3 = 2 / 0;" are not. But this is done only enough to implement the special rule involving constant initializers of bytes, chars, and shorts, which is part of the check for narrowing casts. "int i = 10/0;" does not require doing the arithmetic to check for narrowing casts because the result of the / will always be an int.
I suspect that the reason Java allows 10/0 to go into execution is to allow students like us to practice handling exceptions. At any rate, that is the rule affecting your example.