Exceptions signal errors at runtime.
try { } catch (ExceptionType e) { } finally { }throw new IllegalArgumentException("message");- Checked exceptions (like
IOException) must be caught or declared withthrows. - Unchecked exceptions (
RuntimeExceptionand subclasses) do not have to be. - Try-with-resources closes files and connections automatically:
try (var r = new FileReader(f)) { }