githubEdit

🍑serializable

Serializable is a marker interface in Java1arrow-up-right2arrow-up-right3arrow-up-right4arrow-up-right5arrow-up-right6arrow-up-right. It is used to indicate that a class can be serialized, which means its state can be converted into a byte stream2arrow-up-right3arrow-up-right4arrow-up-right5arrow-up-right6arrow-up-right. Serialization is the process of converting an object's state into a format that can be stored or transmitted and later deserialized back into an object2arrow-up-right3arrow-up-right4arrow-up-right5arrow-up-right6arrow-up-right.To make a class serializable, it needs to implement the Serializable interface2arrow-up-right3arrow-up-right4arrow-up-right6arrow-up-right. This interface acts as a flag to the Java runtime that the class can be serialized1arrow-up-right. It is a marker interface because it does not contain any methods or fields to implement1arrow-up-right2arrow-up-right3arrow-up-right6arrow-up-right.When a class implements Serializable, all of its subtypes are also considered serializable1arrow-up-right5arrow-up-right.However, if a class has a reference to another object, both the class and the referenced object must implement Serializable, or else a NotSerializableException will be thrown5arrow-up-right.

Last updated