I recently read this post: Is Java "pass-by-reference" or "pass-by-value"?
The first answer was far too terse and specific to give me a firm understanding, and everyone else created 15 page essays explaining what should be a simple topic. Are the following rules correct (which are pretty simple if true):
1.) Named things associated with a type that aren't primitives ("objects references" in Java talk) are pointers in C++.
2.) . on a Java pointer is the same as using -> on a C++ pointer.
3.) = on a Java pointer is the same as using = on a C++ pointer.
4.) All functions pass by value (and hence pass Java pointers by value).
(This ignores memory management differences like the fact that = on a Java pointer is fine whereas = on a C++ pointer means you might need to worry about memory management)
The most confusing element to the puzzle is that no one I have seen has conveyed this set of rules/understanding of what Java is doing in clear English (opting instead for 15 pages and diagrams). The second most confusing element is that Java uses the word "reference" in a way that is different from C++. If you want an analogy between what Java is doing in terms of C++, pointers and the rules I created are the simplest terms to digest Java's behavior.