Перейти к содержимому

Java Serialization Explained: Save Objects to a File | Java Course L103

The Modern SDE

0:00 / 0:00

Java Serialization Explained: Save Objects to a File | Java Course L103

2 просмотра · 4 дн. назад
The Modern SDE
854 подписчика
2 просмотра · 4 дн. назад
Lecture 103 of the Complete Java Course for Beginners by Engineer X · Part 7: Files, Networking and Concurrency. In this lecture • Why objects vanish: the heap is wiped when a program ends, so state must be saved to a file • An object's state is the values of its fields • Two ways to save: serialization (for Java programs) or a plain text file (for any program) • java.io streams: connection streams reach a file or network, chain streams add a skill • Saving an object: FileOutputStream, chained ObjectOutputStream, writeObject, close • Watching it run in memory: writing an object copies its state and leaves it unchanged • Common mistake: an ObjectOutputStream can't take a file name on its own Chapters 0:00 Where did the coins go? 1:15 Two ways to save 2:15 Streams: pipes for data 3:36 Saving an object in code 5:30 Common mistake: a chain with no connection 6:18 Recap 6:48 Quick check 7:12 Up next Book reference: Head First Java (Kathy Sierra, Bert Bates, Trisha Gee), 3rd edition, Capture the beat, Saving state, Writing a serialized object to a file, Data moves in streams from one place to another. The explanations, examples and code in this lecture are original. #Java #JavaForBeginners #LearnJava #JavaTutorial #Programming #EngineerX #JavaSerialization #JavaFileIO #ObjectOutputStream #JavaForBeginners