What is the purpose of Serialization in Java?

前端 未结 8 2370
花落未央
花落未央 2020-11-29 15:29

I have read quite a number of articles on Serialization and how it is so nice and great but none of the arguments were convincing enough. I am wondering if someone can reall

8条回答
  •  执笔经年
    2020-11-29 16:09

    While you're running your application, all of its objects are stored in memory (RAM). When you exit, that memory gets reclaimed by the operating system, and your program essentially 'forgets' everything that happened while it was running. Serialization remedies this by letting your application save objects to disk so it can read them back the next time it starts. If your application is going to provide any way of saving/sharing a previous state, you'll need some form of serialization.

提交回复
热议问题