File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes difference between pointer and reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "difference between pointer and reference" Watch "difference between pointer and reference" New topic

difference between pointer and reference


Joined: Dec 05, 2001
Posts: 1
What is the difference between pointers in C and reference in Java
sanj singh
Ranch Hand

Joined: Jun 30, 2001
Posts: 129
Hi Chikki
The references used in Java are a higher level view of the lower level pointers in C.Internally all references are pointers(I'd guess so).
Jim Bertorelli
Ranch Hand

Joined: Nov 28, 2001
Posts: 136
Hi chikkireddi, You should probably post this question in one of the "Java in general" forums. After, of course, registering with a proper name
[This message has been edited by Jim Bertorelli (edited December 05, 2001).]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Moved to Java in General (Beginner's)
Sun Certified Programmer for the Java� 2 Platform
Moderator of the forums:
J2EE and EJB
Other Java APIs

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

I have been in debate after debate over this very question. Please know that there are NO pointers in JAVA. Everything in JAVA is a reference. But also keep in mind that the term reference in JAVA means something different than it does in the C language.

Happy Coding,
Gregg Bolinger

GenRocket - Experts at Building Test Data
Bob Graffagnino
Ranch Hand

Joined: May 30, 2001
Posts: 81
I think of references like this:
They contain a pointer to an object that is in the reference type's inheritance tree.
They contain a list of methods signatures that they can call from the object that it's pointing to.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Pointers in C++ can be manipulated.
This is not true in Java - you can not do operations on references.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: difference between pointer and reference
It's not a secret anymore!