Communiquez avec les autres et partagez vos connaissances professionnelles

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

Suivre

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

user-image
Question ajoutée par varun reddy
Date de publication: 2015/08/26
Vittorio Cerioli
par Vittorio Cerioli , Teacher , ICS Villanterio (PV)

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

Zeron Aintablian
par 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.

More Questions Like This

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