Pass object by reference in Java

No, that is not possible in Java.

In Java, all arguments to methods are passed by value. Note that variables of non-primitive type, which are references to objects, are also passed by value: in that case, a reference is passed by value. Note that passing a reference by value is not the same as passing by reference.

Leave a Comment