I guess java does not have the option \"pass by reference\" .But why ? Because sometimes it is very needed.
I guess the only place you really need pass by reference is to return multiple values from a function like the out
keyword in C. To do this in Java, you can either create a class to hold the objects or use an existing Pair class offered by many libraries.
Similarly, you can pass a stub object that refers to something else and then you can change the reference in the object and see it reflected externally:
public static class Holder {
public T value;
public Holder(T value) {
this.value = value;
}
}
private Holder