|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectImpl.CallByReference
public class CallByReference
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 |
---|
public CallByReference()
Method Detail |
---|
public MyRef test(MyRef ref)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |