今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Runtime exception: Handling of NullPointerException - Java教程
课程: Java Exception Handling
Runtime exception: Handling of NullPointerException
- [Presenter] We have reviewed examples of the runtime exceptions including the number format exception and the arithmetic exception. Now, for the most popular of them all, the Null Pointer Exception or NPE. In this video, we will learn exactly what not to do with them as well as how to resolve NPEs. As the reminder, the null pointer exception is caused whenever your code attempts to use an object that is null or has not yet been instantiated. For example, here on line 109, let's say I made a mistake and forgot to instantiate the sequence list variable to an empty list. Note that my IDE actually gives me a warning on line 110. We can see the warning by clicking on the light bulb here as well as some exception handling options? And we can also see the warning in the bottom left hand corner of my IDE. Remember that NPEs are still runtime exceptions. So our JVM or compiler will allow our application to run and continue. It…
内容
-
-
-
-
-
(已锁定)
What are runtime exceptions?2 分钟 28 秒
-
(已锁定)
Runtime exception: Return NumberFormatException to user9 分钟 25 秒
-
(已锁定)
Challenge: Handle an ArithmeticException3 分钟 59 秒
-
(已锁定)
Solution: Handle an ArithmeticException3 分钟 18 秒
-
(已锁定)
Runtime exception: Handling of NullPointerException6 分钟 16 秒
-
(已锁定)
Runtime exception: Unknown runtime exception4 分钟 18 秒
-
(已锁定)
Challenge: Handle potential runtime exceptions1 分钟 19 秒
-
(已锁定)
Solution: Handle potential runtime exceptions4 分钟 1 秒
-
(已锁定)
-