Page 1 of 1

About Question enthuware.ocpjp.v8.2.1752 :

Posted: Sat Feb 04, 2023 6:30 am
by robhun79
The explanation for the fifth option sounds:
"If the object graph contains non-serializable objects, an exception is thrown and nothing is serialized. Object graph means all the objects that are linked/referenced by the first object (directly or indirectly) that is being serialized. Fields of an Object that are marked as transient are not serialized and so they do not cause an exception. Any field that is not marked transient but points to an object of a class that does not implement Serializable, will cause an exception to be thrown. Thus, the given statement is wrong."

So, what if we have a superclass which does not implement Serializable interface? Will then an exception be thrown as well? Probably not, because otherwise we wouldnt be able to deserialize objects with such a superclass. Can you please explain this?

Re: About Question enthuware.ocpjp.v8.2.1752 :

Posted: Sat Feb 04, 2023 8:12 am
by admin
No, the type of the superclass has no impact on the object graph. Superclass is not a separate object.

Re: About Question enthuware.ocpjp.v8.2.1752 :

Posted: Sat Feb 04, 2023 10:39 am
by robhun79
Thank you!