ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
تاريخ النشر: 2013/08/21
Mohsin khan
من قبل Mohsin khan

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
من قبل 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. 

Faisal Alghamdi
من قبل 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
من قبل mukhtar ahmed Ibrahim , Software engineer , Norwegian tax administration

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. 

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.
 

Advaitha Chidurala
من قبل Advaitha Chidurala , Teacher , Little Masters Abacus

Pointers are generally used to refer to the address of the particular value. there is nowhere the concept of pointers in Java. Null pointer exception is generally raised when you are try to perform some actions with the keyword "null".

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟