Impl
Class CallByReference

java.lang.Object
  extended by Impl.CallByReference

public class CallByReference
extends java.lang.Object

Call-by-reference example. This class, Impl.Types.MyRef and Example.Client3 demonstrate how to emulate call-by-reference in Java. You cannot simply modify ref and return something else, because Java actually uses call-by-value for reference types, too. The ref inside test() is a copy of the ref the caller passed to the method. Therefore, the user code needs to set its ref to the ref returned by test().


Constructor Summary
CallByReference()
           
 
Method Summary
 MyRef test(MyRef ref)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallByReference

public CallByReference()
Method Detail

test

public MyRef test(MyRef ref)