-1

am preparing myselg for some java t and I see something interesting in the java code:

in the ArrayList class I can see this :

  /**
     * The array buffer into which the elements of the ArrayList are stored.
     * The capacity of the ArrayList is the length of this array buffer.
     */
    private transient Object[] elementData;

so how is the list serializable is the array holding the data is tdefined as transient:?

Do they use some trick we can not see like bridge methods, fields or similar..

Thnxs

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97

1 Answers1

4

ArrayList uses readObject() and writeObject() for serialization.

clemens
  • 16,716
  • 11
  • 50
  • 65