About Question com.enthuware.ets.scjp.v6.2.134 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

About Question com.enthuware.ets.scjp.v6.2.134 :

Post by ETS User »

On this question one the answers has an error that is misleading.

"Constructor of the class for an object being deserialized in never invoked."

I thought the question missed the word "is" (instead of misspelling it) to read like this:
Constructor of the class for an object being deserialized in IS never invoked.
I took into account if an object being serialized had members(maybe inherited) that were objects that aren't serialized, their constructors would run.
so I did not choose this selection.

so I chose the answer:
While serializing an object, only those objects in the object graph that implement Serializable are serialized.

I understand the explaination for the answer and I think that it makes it more of a correct answer:
"If the object graph contains non-serializable objects, an exception is thrown and nothing is serialized."
This is not true if the transient modifier is used.

I must admit though that I have never seen the term "object graph" before.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.134 :

Post by admin »

"in" should actually be "is" as in, "Constructor of the class for an object being deserialized is never invoked." This has been fixed.

Option 4 is correct. If an object is indeed being deserialized, its constructor will not be called. If a reference is transient, then the referenced object it is not really being deserialized at all.

The 5th option, "While serializing an object, only those objects in the object graph that implement Serializable are serialized." is wrong because Object that are not serializable are either ignored (if the references to them are marked as transient) or cause an exception to be thrown.

Explanation has been enhanced to explain it better.

Thank you for the feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests