课程: Java 8+ Essential Training: Objects and APIs
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Checked vs. unchecked exceptions - Java教程
课程: Java 8+ Essential Training: Objects and APIs
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…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。