Apologies for asking such a primitive question.
I wrote a function which took one parameter; this parameter was supposed to be an in/out parameter.
After d
Q1: parameters in Java are always passed by value. In the case of objects, you pass the value of the reference, not the reference itself (this is often a cause of confusion). To achieve in/out parameters you have to pass an object that holds a reference to the real parameter.
Q2: immutable means that the object can't be modified, but the variable can. So currentFoo = currentFoo + 1
means: create a new Integer with value currentFoo + 1, then assign this new object to currentFoo.