Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between pointer and reference

 
chikkireddi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between pointers in C and reference in Java
 
sanj singh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
regards
sanj
 
Jim Bertorelli
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to Java in General (Beginner's)
------------------
Tom
Sun Certified Programmer for the Java� 2 Platform
Moderator of the forums:
J2EE and EJB
Other Java APIs
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bob Graffagnino
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pointers in C++ can be manipulated.
This is not true in Java - you can not do operations on references.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic