About Question com.enthuware.ets.scjp.v6.2.134 :
Posted: Tue Jan 04, 2011 8:05 pm
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.
"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.