Here is a line to clear all misunderstandings -
Java is strictly Pass-by-Value.
If at some point you feel that a pass by reference has occured as in your code at second(v,i), you actually are passing the reference itself as a value. Hence any changes made to the reference are reflected in the actual arg.
I hope that you are clear that when we say,
"a" is only a
reference that points to the object. Therefore, when you pass this "a" to a method, you actually pass a reference pointing to that object; which in turn is a pass by value
because the reference is COPIED in the formal argument
Regards