3 ms·
> However, handling exceptions still require a separate catch clause rather than being part of the normal flow Only if you want to catch (handle) it. If you d
by hota_mazi 4y ago
> However, handling exceptions still require a separate catch clause rather than being part of the normal flow
Only if you want to catch (handle) it. If you don't want to do that, just declare it in your "throws" clause and enjoy writing your code with the (guaranteed) assumption that you are using a valid value.
> Furthermore, it is nigh impossible to rely on checked exceptions alone, most Java code may throw RuntimeExceptions such as NullPointerException or ArrayIndexOutOfBoundsException and there is no way to know it by just looking at the calling code.
That's a bug, not a feature. These errors are often unrecoverable, hence why they are runtime and not checked.