RuntimeExceptiontypes are unchecked; all other exceptions are checked. Some examples of unchecked exceptions are dividing by zero (
ArithmeticException), or accessing an index that doesn't exist (
throwkeyword to create exceptions with custom error messages as follows:
try catchblock, as such:
tryingwill be printed.
catchingis printed next.
finallyis printed last.
catchblock. What would this code do?
tryingis printed. 2.
finallyis printed. 3. The program exits with a