1.serializeable is a marked interface with no methods to be implemented. The purpose of this interface is to tell Java that developers allow this class to be serialized. 2. There is no specific test, but access modifiers such as public and private should not affect the serialization process.
Another:
I have previously written a blog article about Java serialization "Java Serialization Basics" which should be able to answer this question and introduce a simple way to call the Java serialization interface. The subject can test the access modifiers and Does serialization matter?
It does not have to be implemented, but some old systems still need it, such as some projects integrating backend and flex end, entities still need to be serialized
1.serializeable is a marked interface with no methods to be implemented. The purpose of this interface is to tell Java that developers allow this class to be serialized.
2. There is no specific test, but access modifiers such as public and private should not affect the serialization process.
Another:
I have previously written a blog article about Java serialization "Java Serialization Basics" which should be able to answer this question and introduce a simple way to call the Java serialization interface. The subject can test the access modifiers and Does serialization matter?
Implements the
Serializable
是因为你需要使用JDK
内置的序列化。以目前的技术来说是否实现
Serializable
接口已经不重要了,因为现在的序列化技术太多,都比JDK
内置的要优秀,而且不需要实现Serializable
interface.EsotericSoftware/kryo
msgpack
FasterXML/jackson
RuedigerMoeller/fast-serialization
google/protobuf
It does not have to be implemented, but some old systems still need it, such as some projects integrating backend and flex end, entities still need to be serialized