The question is "Which of the following approaches can be taken independently of each other so that a Portfolio object can be serialized while preserving the state of the Bond objects contained in Portfolio?"
I translate this as: You want to serialize Portfolio objects including their Bonds. Right?
So I would think that the serialized object must contain the field Bond[] bonds. Does an array not support serialization? Why not just serialize this whole field? Or does it then just serialize the references to bonds objects but leaving out the actual objects it is referencing to? But how will the references to those objects get loaded upon deserialization if the array is transient? I might have preserved the bonds objects but I don't know if they where contained in the array. Thanks a lot!
About Question enthuware.ocpjp.v8.2.1389 :
Moderator: admin
-
- Posts: 33
- Joined: Sat Feb 15, 2020 12:44 am
- Contact:
-
- Site Admin
- Posts: 10398
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1389 :
Bonds array can't be serialized because Bond is not Serializable. There is a detailed explanation that explains this point with sample code describing how it can be done.
Who is online
Users browsing this forum: No registered users and 5 guests