RMI: Pass by Value or by Reference?

前端 未结 2 1227
半阙折子戏
半阙折子戏 2021-01-21 06:12

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 actua

相关标签:
2条回答
  • 2021-01-21 06:56

    That depends on how you coded it.

    Typically any client side objects that represent server side objects simply make remote calls with update the server side objects. The client side objects are nothing more than a facade over the transport protocols used to make the calls to the server.

    If you used RMI, then it will follow this principle.

    0 讨论(0)
  • 2021-01-21 07:07

    That depends if Bank is an instance of Remote or 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 Bank class is not Remote, but is Serializable, then it will be copied and passed by value.

    0 讨论(0)
提交回复
热议问题