JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Serialization of nested objects: nuances

    JAVA 25 SELF
    44 level,0 lecture
    In this lecture, we examine how Java performs deep serialization of an object graph: what happens to reference fields, why all nested objects must implement Serializable, how to avoid NotSerializableException, and in which cases the transient modifier helps. With examples, we will show serialization/deserialization of objects with nesting, collections, and cyclic references, and we will also break down common mistakes related to serialVersionUID and large object graphs.
    Open
  • Nested and Hierarchical Objects: Serializing Graphs

    JAVA 25 SELF
    44 level,1 lecture
    How Java serializes complex data structures: from nested collections and inheritance hierarchies to cyclic object graphs. We’ll examine why serialization of Map<String, List<Book>> works, how concrete subtype information is preserved in List<Animal>, what the reference mechanism does in cycles, and which pitfalls you may encounter. We’ll discuss the roles of ObjectOutputStream/ ObjectInputStream, the writeObject/ readObject methods, the serialVersionUID field, and the transient modifier.
    Open
  • Cyclic references problem: detection and handling

    JAVA 25 SELF
    44 level,2 lecture
    We examine what cyclic references are in object graphs, why they are dangerous for serialization, and how to deal with them. It is shown how Java’s standard streams — ObjectOutputStream/ ObjectInputStream — automatically track already encountered objects and write references (handles), preventing StackOverflowError. We will cover the pitfalls of custom serialization ( writeObject/ readObject, defaultWriteObject/ defaultReadObject), as well as strategies for handling cycles in JSON: annotations @JsonIdentityInfo, @JsonBackReference/ @JsonManagedReference, excluding fields via transient, and using identifiers.
    Open
  • Object identity in binary serialization

    JAVA 25 SELF
    44 level,3 lecture
    How Java preserves and restores object identity during binary serialization: why equivalence via a. equals( b) is not the same as identity ( a == b), how ObjectOutputStream/ ObjectInputStream track the object graph and write “back references” instead of duplicates, why this works correctly with cycles, and how the methods writeReplace() and readResolve() can affect the resulting identity. Walkthrough with examples: cycles, shared references, practice, and common mistakes.
    Open
  • Review of common mistakes in collection serialization

    JAVA 25 SELF
    44 level,4 lecture
    In this lecture, we break down the most frequent issues when serializing collections: from java.io.NotSerializableException (when elements do not implement Serializable) and generics pitfalls with ClassCastException to class version incompatibilities via serialVersionUID. We will discuss nuances of immutable collections ( List.of(), Set.of(), Map.of()), the behavior of transient/ static fields, as well as performance and file size, where streaming writes and compression ( GZIPOutputStream) help. You will get practical tips, code examples, and recommendations for safe deserialization ( readObject/ writeObject).
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy