Kram wrote:
> Does Java have pointers? I have been trying to get a definitive answer
> using Google and half the sites say that Java has Pointers the other
> half say no.

Half of them are wrong.  Don't listen to them. :)

> I have found on the Sun website that Java does not have Pointers.
> Which really answers my question, but if references can be thought of
> in similar fashion, what is the difference between the two.

Between which two?  If it's between Java references and Java pointers, 
the answer is one exists and the other doesn't.

If its between Java references and pointers in some other language, say 
pointers in C, the answer is that C pointers points to regions in 
virtual memory, Java references points to something more abstract--a 
Java object.  And you can do a number of things to C pointers that you 
can't do to Java references, like "advancing to pointer" by pointer 
arithmetic: p+=1;

> I would like it very much if someone could clearly identify for me the
> difference between Pointers and References.
> 
> And the million dollar question: Why, if Java does not have pointers,
> can you get a NullPointerException?

They temporarily forgot that Java doesn't have pointers when they named 
that exception.

-- 
Weiqi Gao
[EMAIL PROTECTED]
http://www.weiqigao.com/blog/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to