 Originally Posted by ninja9578
I looked back at some java books, I guess I was wrong.  I was confused because of the lack of explicit definitions. At least none of my professors ever used any. I can't recall ever seeing a -> in java, it was always foo.a. Am I correct there?
Well, you are correct that Java does not have an arrow operator because the language doesn't use pointers. The dot operator in Java is really just a namespace operator. In regards to the issue of call by value versus call by reference, all non-primitive variables (i.e. not int, short, long, char, or byte) are references to objects in memory, so passing them to a method passes references to the same objects in memory, similar to appending an ampersand in a C++ function parameter. Any changes the method makes to the object will remain after the method is called.
|
|
Bookmarks