什么是Java中的Serializable? [英] What is Serializable in Java?
问题描述
Possible Duplicate:
What does Serializable mean?
我有
class Person implements Serializable {
}
如果我只是使用
class Person {
}
推荐答案
serializable是一个特殊的接口,指定该类是serialiazable。它的特殊之处在于它不像普通接口那样定义任何必须实现的方法:它只是将类标记为可序列化。有关详细信息,请参阅Java docs 。
serializable is a special interface that specifies that class is serialiazable. It's special in that unlike a normal interface it does not define any methods that must be implemented: it is simply marking the class as serializable. For more info see the Java docs.
关于什么可序列化意味着它只是意味着将类(对象)的实例转换为可以写入磁盘或可能传输的格式通过网络。例如,您可以将对象保存到磁盘并稍后重新加载,并保存所有字段值和内部状态。有关详细信息,请参阅维基百科页面。
As to what "serializable" means it simply means converting an instance of a class (an object) into a format where it can be written to disk, or possibly transmitted over a network. You could for example save your object to disk and reload it later, with all the field values and internal state saved. See the wikipedia page for more info.
这篇关于什么是Java中的Serializable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!