Understanding parameter passing in Java: Call By Value

Some of the first semester students participating in the lecture Algorithms and Datastructures where I am working as tutor seem to have problems understanding how parameter passing works in Java, so I decided to do a little writeup on this.

The most confusing part seems to be the passing of object references to methods, so I will mainly put the focus on this. But let us start with primitive parameters first.

Continue reading