When java does not support pointer then why we will get NullPointerException | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When java does not support pointer then why we will get NullPointerException

16th Aug 2020, 9:34 AM
CodeBreaker
CodeBreaker - avatar
3 Answers
+ 1
Java does not support pointers but Reference Variable that store reference addresses generally called Objects ( pointers like concept) . Pointers points to variable directly but java’s reference variable points to some other places which carries the address of the data variable. In this way java does not support pointers. And NullPointerException is thrown when an application attempts to use an object reference that has the null value.
16th Aug 2020, 11:02 AM
Vishakha Shrivastav
Vishakha Shrivastav - avatar
0
Java does not support pointer but it can have null values for objects which are declared but not initialized any values..
16th Aug 2020, 11:23 AM
Jayakrishna 🇮🇳
0
because internally uses it if there is Object, you can copy the value of this 'pointer', but can't increment it or get a reference of primitive type like int a
16th Aug 2020, 12:50 PM
zemiak