Conceptual questions about serialization!

Asked 2 years ago, Updated 2 years ago, 97 views

Hello! I have a question about serialization today, so I'm leaving a message!

Serialization is used to store objects in files or send or receive them over the network.

If you serialize it, the method is not saved anyway (although it may vary depending on the library..?), and it is shown in the book that you are currently viewing that it stores instance variables that vary from object to object. (Java book))

Well, the ultimate question is... "You can take variables out of an object through getter and save them to a file, and you can recover the object through setter when you recover, but do you just use it because it's convenient to do it through serialization?"

Thank you. Haha

serialization

2022-09-22 20:23

1 Answers

You just need to understand the purpose of serialization correctly.

As mentioned in the question, using getter and setter on an object is possible if you are on the same computer. Therefore, you don't have to worry about serialization when using the same computer.

However, if you're worried about sending this object you're using to another computer (or when it's shut down and re-run), serialization is required.

Basically, you can think of the following.


2022-09-22 20:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.