posted 11 years ago
Nothing happens. The catch block will only catch an exception thrown in the Try block. If nothing happens in the try block, then no exception could ever possibly be thrown and therefore whatever is in the catch block would never be executed.
It wont throw a compiler issue, i.e. it will compile. But its pointless to add such a thing to any application.
It wont throw a compiler issue, i.e. it will compile. But its pointless to add such a thing to any application.
posted 11 years ago
Wrong. This code produces a compiler error:
It wont throw a compiler issue, i.e. it will compile.
Wrong. This code produces a compiler error:
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
posted 11 years ago
The compiler will not complain about any unchecked exception -- or any throwable class that an unchecked exception is an instance of. There are unchecked exceptions that are instance of the Exception and Throwable classes, hence, it will not complain.
Henry
e and t exceptions are also allowed. Are they also considered as checked exceptions?
The compiler will not complain about any unchecked exception -- or any throwable class that an unchecked exception is an instance of. There are unchecked exceptions that are instance of the Exception and Throwable classes, hence, it will not complain.
Henry
Stary Kapec
Ranch Hand
Posts: 81
