Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Java is not supporting pointer, then why jvm is throwing null pointer exception?

user-image
Question added by Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date Posted: 2013/08/21

java does indeed have pointers.They can have two kinds of values-1)refrences to objects2)null  This is a language used in specification.

Daanish Rumani
by Daanish Rumani , Product Manager , Publicis Sapient

It is a badly named exception perhaps due to its C++ roots.
Interestingly C# calls the corresponding exception as NullReferenceException. 

Gopal kulkarni
by Gopal kulkarni , NexGen , nexgen

java support pointer internally.

Deleted user
by Deleted user

Java as any java developer knows doesnt support pointers like c++ , however as u know the JVM supports reference, and references point to objects' places in the virtual machine's memory.so as a conclusion its a badly-named exception and probably got its name as a heritage from C.
 

Faisal Alghamdi
by Faisal Alghamdi , Senior IT Supervisor , al-nahdi medical company saudi arabia

Definitely there are pointers in Java and the null pointer error is one of them but they are managed by the JVM.
However, you are not required to deal with them "directly" as you do with C++.
You create refrences by delclaring new variables..
They are pointers.
When you declare a variable "pointer" then you need to initialize before using this variable..
otheriwse you will get an error.

mukhtar ahmed Ibrahim
by mukhtar ahmed Ibrahim , Software Engineer , the norwegian tax administration (skatteetaten)

We don't use pointers in java. But internal implementation of JVM uses pointers.  When you allocate memory for an object by calling new, you get back a pointer. 

More Questions Like This