Discussion about this post

User's avatar
Owen O'Malley's avatar

This article is very misleading. Java is pass by value for primitives, which includes references, and pass by reference for objects.

I would argue that changeAgeAndPerson should have been a compile time error, because it almost certainly isn’t what the programmer desired. Of course programmers who need to create a new object, usually explicitly return it from the function.

Expand full comment
2 more comments...

No posts

Ready for more?