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

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

متابعة

When java doesn't support pointers. why does it throws null pointer exception?

user-image
تم إضافة السؤال من قبل varun reddy
تاريخ النشر: 2015/08/26
Vittorio Cerioli
من قبل Vittorio Cerioli , Teacher , ICS Villanterio (PV)

When you see "NullPointException", it means that you are using a variable that is not instantiated.

Zeron Aintablian
من قبل Zeron Aintablian , Software Engineer / Architect , DC Soft S.A.L

Any Java variable you declare, then instantiate by the 'new' keyword, will "point" to a location in memory.  It is a reference to this location. NullPointerException is just a name, it could be anything.  When you try to use a variable which is NOT YET instantiated, it points nowhere and can do noting. hence the exception.

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

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