| Author |
Null'Pointer'Exception...
|
Vijay Vaddem
Ranch Hand
Joined: Feb 13, 2004
Posts: 243
|
|
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
Joined: Oct 12, 2000
Posts: 5093
|
|
|
there are pointers, you just can't declare them yourself.
|
42
|
 |
Vijay Vaddem
Ranch Hand
Joined: Feb 13, 2004
Posts: 243
|
|
Hi, Can you give an example over this?? Regards, Vijay
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
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.)
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Jeroen Wenting
Ranch Hand
Joined: Oct 12, 2000
Posts: 5093
|
|
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
Joined: Jul 08, 2003
Posts: 24061
|
|
|
Here's a recent pontification on this very topic.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: Null'Pointer'Exception...
|
|
|