What is Null pointer expections in Java | Sololearn: Learn to code for FREE!

+3

What is Null pointer expections in Java

#1 Question

10/16/2021 7:21:23 AM

ASHUTOSH CHAUDHARY

6 Answers

New Answer

+2

https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it

+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.