Parameter passing mechanism in Java - Java only supports call-by-value - When a function (caller) passes an object reference to another function (callee), it passes a reference by value. See MemoryRep.java in Lecture 8 for examples. Every function that you see in MemoryRep uses call-by-value, i.e., a copy of a value is passed when a value is passed from a caller to a callee. If Java allows call-by-reference, the semantics that you get would be quite different. For example, if it was done by call-by-reference, the changes that you make in swap for x and y would affect the values of i and j in the first call of swap in main of MemoryRep.java. Similarly, for the cut function and the cut call in main. That is why I said Java passes a reference by value, which is quite different than saying Java supports a call-by-reference parameter passing mechanism. If you don't want to worry about call-by-reference, that is fine. I just wanted to mention this for those who might be interested. Or, you might hear someone saying that Java also supports call-by-reference at some point somewhere and you will know that that person is saying something that is incorrect. - When we called swap2 with an array as an argument in the main of MemoryRep.java, the changes that you make inside the array in swap2 survives the function call. That is, the changes that you make in the array from swap2 are visible from the main as well. This looks much like what call-by-reference would do, but technically it is still a call-by-value. The distinction between call-by-value and call-by-reference is not that important for us. You will learn them in more detail when you take CSE 216. For us for now it is important how changes that you make in a callee affects the values in the caller when you pass a primitive type value versus when you pass an object type value. Remember that an array is an object!