This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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: 43980
    
  33
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: 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: 14952
    
  26

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: C++ Pointers correspondencee to java variables
 
It's not a secret anymore!