Throwing & Custom Exceptions
Learn to throw exceptions explicitly and define custom exception classes.
Intro
Sometimes you need to signal an error yourself. Java lets you throw exceptions explicitly and even create custom types.
Throw keyword
The throw statement creates and sends an exception. Use it inside methods to indicate something went wrong.
All lessons in this course
- Throwing & Custom Exceptions
- try-with-resources (AutoCloseable)
- Defensive Programming