Java / Exception
Should a catch block always follow try block in Java for Exception handling?
No. try needs catch, finally, or both. try-with-resources can stand with neither if you do not handle the exception there. A bare try does not compile.
The try block needs to be followed by either catch or finally block or both. Any exception thrown from a try block needs to be either caught in the catch block or else any specific tasks to be performed are placed in the finally block. The exceptions that are likely to be thrown should be declared in the throws clause of the method.
More Related questions...