ModernJava
ModernJava copied to clipboard
Exceptions (list vanilla)
Somewhere in the exception chapter it should list the most commonly used vanilla exceptions
Most common picks for throwing own exceptions:
- IllegalArgumentException
- IllegalStateException
Other common RTEs:
- IndexOutOfBoundsException
- NoSuchElementException
- NullPointerException
- UncheckedIOException
- UnsupportedOperationException
Checked exceptions:
- IOException
Error occasionally used for throwing:
- AssertionError
Also maybe OutOfMemoryError and StackOverflowError since they are pretty important.
StackOverflowError specifically must be explained at the start of the recursion chapter, something like:
Remember when you saw a stacktrace? Imagine when there is an infinite call tree due to recursion, this will cause a StackOverflowError.
So if you have one, you might have infinite recursion.