Wheels is a object which cannot be serialized. Cars can be serialized. Wheels is not instantiated yet inside Cars so Cars object does not have Wheels object. Thus Cars object can be serialized and one object gets serialized. If Wheels object would have been instantiated then the Cars object would have a wheels object inside it and in that case that object cannot be serialized. It would throw NotSerializable exception then.
Its not easy to be a compiler [ April 27, 2007: Message edited by: megha joshi ]
Just one small point. I take it that this question is not one of those from Sun's Practive Exam that you have agreed to not to disclose? That is, it is not from Sun's online US$ 75 test? [ April 28, 2007: Message edited by: Barry Gaunt ]
I do agree with you all, but only when a new instance of the Wheels is created. In this question option "B" is correct. Having only a reference of the class that is not Serializable is no more sin that could hinder the proper Serialization of the containing class object.
Megha described the rest part very well.
Barry, the question I picked from says "Courtesy to sun practice exam"! What to do, should I remove this question? [ April 30, 2007: Message edited by: Chandra Bhatt ]
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!