private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(nameA);
}
what the method does out.defaultWriteObject (); and why we need it?
Dyskutowane
Komentarze (2)
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Gellert Varga
12 grudnia 2021, 12:12
On the topic of defaultWriteObject() and serialization, I got some more very good answers in this link below, and even better understanding of how it all works. Maybe it will help you too:
https://codegym.cc/help/16224
0
Gellert Varga
9 grudnia 2021, 00:27przydatny
I have also only read in the oracle API:
"It writes non-static and non-transient fields of the current class to the current stream. This method can only be called from the writeObject method of the class being serialized."
Also, I had a similar question yesterday, it is very useful to read the answer I got:
https://codegym.cc/help/16217 +1