I’m having trouble finding a clear answer to this question so I thought I’d ask here with my own specific example:
I am creating a mulitplayer monopoly game. The actual monopoly code runs on the server and the client is essentially a GUI which accesses and control this code. The monopoly game is controlled by a class called ‘Bank’.
Say I did this in the main() of my client:
Bank banker = server.getBank(); //gets the bank object from server
bank.turn(); //moves the current player
Would this call turn() on the Bank object on the server or on a copy of it on my local machine?
Update: Bank does not implement remote. It is a serializable object.
That depends if
Bankis an instance ofRemoteor not. If so, then it will be passed by reference (if all is set up correctly), if not it’ll be serialized and passed by value.edit: Since your
Bankclass is notRemote, but isSerializable, then it will be copied and passed by value.