From the course: Java 8+ Essential Training: Objects and APIs

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Checked vs. unchecked exceptions

Checked vs. unchecked exceptions - Java Tutorial

From the course: Java 8+ Essential Training: Objects and APIs

Start my 1-month free trial

Checked vs. unchecked exceptions

- [Narrator] Java exceptions come in two main flavors: checked and unchecked. An unchecked exception doesn't have to be declared, but if it isn't caught and handled it causes the application to exit, sometimes ungracefully. The two kinds of exceptions I've used so far are unchecked exceptions, array index out of bounds exception and in a previous video, the null pointer exception. I don't have to do anything special in my code in order to be able to deal with these exception classes, so for example, if I change my code to introduce an exception on purpose, I'll be able to compile and run the application, but when the exception is encountered, the application exits. Now, here's why that works. I'm going to click into the name of the class, array index out of bounds exception, and press Shift F1 to go to the online help. If that doesn't work for you, you'll need to remember to configure IntelliJ IDEA to use the online help, and I describe how to do that in the first course in this…

Contents