posted 17 years ago
The first case does not compile, because an ArithmaticException is explicitly thrown before the System.out.println() statement, thereby making it unreachable code. The compiler can determine this.
The second case does compile, but throws the ArithmaticException at runtime, because the compiler can not pick-up on the divide-by-zero bug, and is therefor unable to determine that the System.out.prinln() statement is effectively unreachable code.
Edit: Late again...
[ March 18, 2008: Message edited by: Jelle Klap ]
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.