This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null'Pointer'Exception...

 
Vijay Vaddem
Ranch Hand
Posts: 243
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Im sure there is no Pointers in Java...

So, Just wanted to know why the name Null'Pointer'Exception???


:roll:
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there are pointers, you just can't declare them yourself.
 
Vijay Vaddem
Ranch Hand
Posts: 243
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can you give an example over this??


Regards,

Vijay
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not the first person to be surprised that a language without pointers has something called a NullPointerException.

I don't know for sure, but I'd guess that this is a bit of a misnomer, and that a better name for this type of Exception would probably have been NullReferenceException. (It's too late to change it, now.)
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
References are really pointers to objects.
But where a pointer can be directly manipulated (the dreaded pointer arithmetics in C), references cannot. Because of that no special syntax is needed to dereference them, the runtime environment/compiler/JVM understands that a call to the reference means to address the memory structure in the memory space referenced by the reference and not the raw memory itself.

Small but important distinction.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a recent pontification on this very topic.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic