This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes C / C++ and the fly likes C++ Pointers correspondencee  to java variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » C / C++
Bookmark "C++ Pointers correspondencee  to java variables" Watch "C++ Pointers correspondencee  to java variables" New topic
Author

C++ Pointers correspondencee to java variables

michael delta
Ranch Hand

Joined: Aug 11, 2009
Posts: 35

I've began a c++ course and i'm trying to get a deeper understanding of pointer.So could someone give me a correspondencee of c++ pointers to java variables(for arrays,objects etc if possible). Thank you.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38031
    
  22
You only notice the correspondence in C++, never in Java™. The pointer actually tells you which memory location you are at. You never notice the pointers in Java™ like that (in fact they can change during the execution of an applicaiton if the garbage collector runs).

I think this would sit better on another forum: moving.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

i went from c ( k&r style) to java, so i can tell you the wonderful ways pointers are missing in java.

The whole collections interface had to be done manually maintaing pointers. I am sure they are there in java just hiding.
Gary Ba
Ranch Hand

Joined: Oct 23, 2009
Posts: 150

Everything in Java is a reference. Look at this this and you will have a better understanding of it.


star chaser..
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Not everything is a reference - variables of primitive types (byte, short, int, long, boolean, char, float, double) are values, just like in C and C++. But all variables of non-primitive types are indeed references in Java.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
 
subject: C++ Pointers correspondencee to java variables
 
Similar Threads
difference between pointer and reference
Java in data structures and linked list
Garbage Collection
Why reference variables cannot be used as pointers
Equivalent of C++ Pointers