When creating objects we write something like this:
in Java:
test t = new test();
in C++:
test *t = new test();
So if the t variable gets the address of the new object, does it mean that t in Java is actually pointer like in C++?
When creating objects we write something like this:
in Java:
test t = new test();
in C++:
test *t = new test();
So if the t variable gets the address of the new object, does it mean that t in Java is actually pointer like in C++?
Yes, it's a kind of pointer, called reference in Java. However, it's not identical to a C++ pointer.
 
    
    