+ 2

NullPointerException

What is an NullPointerException? What does it mean? And what can I do to avoid it? Thanks for your help!

28th Jan 2019, 5:30 PM
TCB
TCB - avatar
3 Antworten
+ 3
This is when you try to do an illegal operation with a null pointer, like trying to dereference it.
28th Jan 2019, 5:45 PM
Zen
Zen - avatar
+ 3
In java ? Usually you havent initialize the object but trying to use it. Ex. PrintWriter file; file.println("lol"); //This will cause nullpointer error
28th Jan 2019, 5:47 PM
Taste
Taste - avatar
+ 2
Both are right! Thank you so much!!! You helped me a lot!!
28th Jan 2019, 6:59 PM
TCB
TCB - avatar