From the course: Java Exception Handling
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
What are runtime exceptions? - Java Tutorial
From the course: Java Exception Handling
What are runtime exceptions?
- [Instructor] We have covered throwables and exceptions in a broader scope so far in this course. This chapter, we will dive into examples of runtime exceptions. In this video, we revisit what runtime exceptions are. Runtime exceptions are unchecked exceptions. This means our JVM or the Java Virtual Machine does not check for these exceptions at compile time when code is compiled. Apps will likely not be able to automatically recover from an unchecked exception as they are not always anticipated when writing the code. If you recall, unchecked exceptions do not have to be declared in a methods header like checked exceptions. Of all of the different runtime exceptions, NullPointerExceptions or NPEs for short are probably the most popular runtime exceptions. They can occur anytime an action is attempted on an object that is null. If a method forgets to initiate a string variable and attempts to use that variable in some way,…
Contents
-
-
-
-
-
(Locked)
What are runtime exceptions?2m 28s
-
(Locked)
Runtime exception: Return NumberFormatException to user9m 25s
-
(Locked)
Challenge: Handle an ArithmeticException3m 59s
-
(Locked)
Solution: Handle an ArithmeticException3m 18s
-
(Locked)
Runtime exception: Handling of NullPointerException6m 16s
-
(Locked)
Runtime exception: Unknown runtime exception4m 18s
-
(Locked)
Challenge: Handle potential runtime exceptions1m 19s
-
(Locked)
Solution: Handle potential runtime exceptions4m 1s
-
(Locked)
-