-6

There are many articles asking to help with their code but not many actually answer what this means. Java doesn't use pointers on the user side but I get a null pointer exception error in my Java code sometimes and it made me wonder.. Does Java use pointers behind the scenes?

Or is this just a term that is used to describe a definition error.

Chris Collins
  • 89
  • 2
  • 11
  • it means that the reference you have created for an object has null in it... or the object is not initialized... – CoderNeji Jul 28 '15 at 10:19
  • 1
    Please consider to search stackoverflow first before posting a question. – moffeltje Jul 28 '15 at 10:21
  • read the documentation: docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html – tonychow0929 Jul 28 '15 at 10:24
  • [What is difference between references and objects in java?](http://stackoverflow.com/questions/9247886/what-is-difference-between-references-and-objects-in-java) or [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – Naman Gala Jul 28 '15 at 10:24
  • Null pointer means not using pointer concept java is object based so object is not creating means its memory is null so its returns null pointer exception don't true translate java language words . – Chandu D Jul 28 '15 at 10:27

1 Answers1

2

Java doesn't use pointers, but uses references. NullPointerException is a way to say that an attempt is made to send a message (invoke a method) using reference which doesn't point to any object. It has nothing to do with pointers in the sense of C/C++.

Andrii Polunin
  • 1,306
  • 11
  • 15