Selenium automation testing course with Java- Serialization in Java- class 38

Опубликовано: 27 Февраль 2026
на канале: Learn Java
181
5

You can learn Java with me as the Java Programming language is being made easily. It would take a period of minimum three months and maximum 6 months to master Java. I would recommend you to watch all my videos to crack any software interviews that would require Java Programming language as a primary skill.

Serialization in Java:-
=================
Serialization in Java is the process of converting an object’s state into a byte stream, so that it can be:
Stored in a file or database
Sent over a network
Saved in memory for later use
The reverse process (converting the byte stream back into an object) is called Deserialization.

Key Points about Serialization:
Implemented by java.io.Serializable interface
A marker interface (contains no methods).
Any class that needs to be serialized must implement Serializable.

Serialization API
===============
ObjectOutputStream is used for writing objects to a stream.
ObjectInputStream is used for reading objects from a stream.

serialVersionUID
=================
A unique identifier for classes during serialization and deserialization.
Ensures that a serialized object matches the class definition when deserialized.
If not declared, JVM generates one automatically, but it may change when the class is modified.

Transient Keyword
==================
Fields marked transient are not serialized.
Example: passwords, sensitive information, or derived values.
Static fields are not serialized
Because they belong to the class, not to an instance.