ModernJava icon indicating copy to clipboard operation
ModernJava copied to clipboard

Exceptions (list vanilla)

Open Zabuzard opened this issue 4 months ago • 1 comments

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

Zabuzard avatar Sep 22 '25 08:09 Zabuzard

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.

Alathreon avatar Nov 07 '25 22:11 Alathreon