+ 3
What is Null pointer expections in Java
#1 Question
6 odpowiedzi
+ 2
if variable for some object is null
it means is empty
you can't call any method of object in variable, because there is not any object
Object o = null;
o.hashCode(); //NullPointerException
+ 2
Adithya Keshav T
Exception definition is it is a runtime error
It is basic definition
Exception is a kind of error that can be handled but not rectified
+ 1
NullPointerException is a runtime exception and it is thrown when we try to use an object reference which has a null value.
Ex:
https://code.sololearn.com/cWW2MY3wT22u/?ref=app
+ 1
NullPointerException is a type of runtime error
The object that we are either created or in usage is not having memory
Ex : Student - class
It is having method wish();
I am doing this
Student s;
s.wish();
The above 2 statements will raise java.lang.NullPointerException
Since the value of s is null by default
+ 1
sree harsha
NullPointer is an runtime exception.
Runtime errors are different from runtime exceptions.