What is serialization in java | Sololearn: Learn to code for FREE!


What is serialization in java

In the google it's like it is a process to convert object into byte array... Why are we converting it? .. What's the use of converting? Pls explain in a simple words

4/11/2021 7:28:34 AM

Karthik Reddy Thotamgari

8 Answers

New Answer


It is useful when you want to save the object you are working with. Any objects you create in your program are stored in memory, which is cleared once your program is closed. This becomes a problem when you want to save the state of your object for the next launch of the program. So, here comes the serialization. Basically, it makes it possible to save object into a file or database (uncommon).


Benjamin Jürgens Sure, it is uncommon. But, as you said, it is possible. This is why I mentioned a database.


Igor Makarsky to save serialized data in a database is very uncommon. You can do that of course (as a BLOB), but for the most part you have one table for every type of object and map each object property to a DB column


Karthik Reddy Thotamgari you serialize Java objects that you have in your running Java program. The major use cases are: - To transmit it. Transmission is done as a byte stream - To save in a file as array of bytes


Just now I've read about serialization in google... That means the process of converting obj state into persistent (permanent) state... To use serialization the class must implement Serializable... And the file must have extension (.ser) ..


To transmit or save in a file


U mean transmission of file?


serialization - the process of transmitting the object to an array of byte deserialization - the reverse process of serialization ie, an array of bytes to an object why: we can reuse this state of an object when needed if it is stored in a file or a database in the stream of bytes(file with .ser extension).