When we programming with java, we can see 'java.lang.NullPointerException' error often. NullPointerException is kinds of RuntimeException.
This error occurs as a Java program attempts to use a null when an object is required. Let's see what this means.
This codes makes NullPointerException because invalid_intObject is object but it's null. Below is valid code.
But in real programming world, this is not that simple to debug. So, what's in real programming world? we always call functions that we did not make.
This is real world. UserfulFuncion could be standard library or opensource library. and Exception could be like below:
Actually in real world, the Exception line could be more than 10 lines. then we should track the Exception lists till my code appears.
we should see App.java file line 22. that's
in my app.App.main(App.java) file line 11 is
now, we can solve the problem by assigning just before the error. ex) 'invalid_intObject = 0;'
Comments
Post a Comment