12 - Java Serialization with file - Theory

@Rishi Srivastava -------------------------------------------------------------------------------- Chapter 03 - Serialization with file -------------------------------------------------------------------------------- It would be incredibly useful if an object could exist and hold its information even while the program wasn’t running. Then, the next time we started the program, the object would be there, and it would have the same information or state it had the previous time the program was running. Object serialization allows us to implement persistence. Persistence means that an object’s lifetime is not determined by whether a program is executing; the object lives in between invocations of the program. By taking a serializable object and writing it to disk (via file), then restoring that object when the program is re-invoked, we’re able to produce the effect of persistence. Java Object ==| Stream of bytes ==| File File ==| Deserialize from stream of bytes ==| Java O
Back to Top