What is the penalty for unnecessarily implementing Serializable?

前端 未结 4 476
天命终不由人
天命终不由人 2020-12-11 17:23

I need to develop a Java RMI application for my distributed systems class.

During the lecture, the professor was stressing to only let classes implement Seriali

4条回答
  •  忘掉有多难
    2020-12-11 17:40

    I would understand the professor's "only let classes implement Serializable that have to be passed by value over the network" differently. I would think the idea is that if you have to use a class in this way then make your own implementation of writeObject, readObject and readObjectNoData, which could be more efficient than the default implementation.

提交回复
热议问题