File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Languages » C / C++
Bookmark "C++ Pointers correspondencee  to java variables" Watch "C++ Pointers correspondencee  to java variables" New topic

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

Joined: Oct 13, 2005
Posts: 46353
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

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: 161

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: 15082

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 8 API documentation
I agree. Here's the link:
subject: C++ Pointers correspondencee to java variables
It's not a secret anymore!