• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

C++ Pointers correspondencee to java variables

 
michael delta
Ranch Hand
Posts: 35
Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything in Java is a reference. Look at this this and you will have a better understanding of it.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic