# serializable

Serializable is a marker interface in Java[1](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)[2](https://www.geeksforgeeks.org/serialization-in-java/)[3](https://www.digitalocean.com/community/tutorials/serialization-in-java)[4](https://docs.oracle.com/javase/tutorial/jndi/objects/serial.html)[5](https://www.baeldung.com/java-serialization)[6](https://www.javatpoint.com/serialization-in-java). It is used to **indicate** that **a class can be serialized**, which means **its state can be converted into a byte stream**[2](https://www.geeksforgeeks.org/serialization-in-java/)[3](https://www.digitalocean.com/community/tutorials/serialization-in-java)[4](https://docs.oracle.com/javase/tutorial/jndi/objects/serial.html)[5](https://www.baeldung.com/java-serialization)[6](https://www.javatpoint.com/serialization-in-java). 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 object[2](https://www.geeksforgeeks.org/serialization-in-java/)[3](https://www.digitalocean.com/community/tutorials/serialization-in-java)[4](https://docs.oracle.com/javase/tutorial/jndi/objects/serial.html)[5](https://www.baeldung.com/java-serialization)[6](https://www.javatpoint.com/serialization-in-java).To make a class serializable, it needs to implement the Serializable interface[2](https://www.geeksforgeeks.org/serialization-in-java/)[3](https://www.digitalocean.com/community/tutorials/serialization-in-java)[4](https://docs.oracle.com/javase/tutorial/jndi/objects/serial.html)[6](https://www.javatpoint.com/serialization-in-java). This interface acts as a flag to the Java runtime that the class can be serialized[1](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html). It is a marker interface because it does not contain any methods or fields to implement[1](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)[2](https://www.geeksforgeeks.org/serialization-in-java/)[3](https://www.digitalocean.com/community/tutorials/serialization-in-java)[6](https://www.javatpoint.com/serialization-in-java).When a class implements Serializable, all of its subtypes are also considered serializable[1](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)[5](https://www.baeldung.com/java-serialization).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 thrown[5](https://www.baeldung.com/java-serialization).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yunaeecy.gitbook.io/wiki/java/serializable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
