Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date de publication: 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
par 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
par Gopal kulkarni , NexGen , nexgen

java support pointer internally.

Utilisateur supprimé
par Utilisateur supprimé

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
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?