I'm a C++ programmer, but I'm beginning to learn Java, and from what I see so far the two languages are very similar. The main difference I hear is that C++ has pointers and Java doesn't, but from my understanding Java does have pointers in a sense, the user is just not aware of it.
From what I've read in my book so far, I am under the impression that when you declare a variable of a complex data type (not sure if that's the right word, I mean like a self-defined class vs. an int) it is automatically a pointer. You cannot make it so that it is not a pointer. And when you declare a variable with a simple data type, it is not a pointer, and nothing you can do will make it a pointer? Is this assumption correct?
Like, this java code (sorry if there are minor syntax errors, as I'm used to C++):
bill = new Student();
bill.GPA = 4.0;
is equivalent to this C++ code:
bill = new Student;
bill->GPA = 4.0;
Is that a correct "translation"?
Edited 4 Years Ago by peter_budo: closing