...BEE MBA PMP SCJP-6
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Please tell us where you got that from; you appear to have misunderstood the chapter, or there was something not clear there.sai prashanth wrote: . . . chapter on serialization.. . . .
Abimaran Kugathasan wrote:If a Sub class is serialized, it doesn't mean that its super class is also serialized. When a subclass is de - serialized, the no-argument Constructor of the super class will run.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:
A little more precise, the no-argument constructor of the first non-Serializable parent class will be called. If the super class is also Serializable then its constructor will not be called. In some cases that first parent is java.lang.Object.
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Campbell Ritchie wrote:
Please tell us where you got that from; you appear to have misunderstood the chapter, or there was something not clear there.sai prashanth wrote: . . . chapter on serialization.. . . .
Rob Prime wrote:
Abimaran Kugathasan wrote:If a Sub class is serialized, it doesn't mean that its super class is also serialized. When a subclass is de - serialized, the no-argument Constructor of the super class will run.
A little more precise, the no-argument constructor of the first non-Serializable parent class will be called. If the super class is also Serializable then its constructor will not be called. In some cases that first parent is java.lang.Object.
sai prashanth wrote:
1. Is it true that if a class is serialized then its child classes is also subjected to serialization, unless there is a class which satisfies a -HAS-A- principle and that class is not serializable?
sai prashanth wrote:
2. What happens if the first parents class is something other than Object and that parent class does not have a no-org constructor, say someone has defined a constructor with args ( which then would not allow for the default no arg constructor to exist unless you define it) ?
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Abimaran Kugathasan wrote:
sai prashanth wrote:
1. Is it true that if a class is serialized then its child classes is also subjected to serialization, unless there is a class which satisfies a -HAS-A- principle and that class is not serializable?
Have a look on this
sai prashanth wrote:
2. What happens if the first parents class is something other than Object and that parent class does not have a no-org constructor, say someone has defined a constructor with args ( which then would not allow for the default no arg constructor to exist unless you define it) ?
Why don't you try it?
Abimaran Kugathasan wrote:
sai prashanth wrote:
2. What happens if the first parents class is something other than Object and that parent class does not have a no-org constructor, say someone has defined a constructor with args ( which then would not allow for the default no arg constructor to exist unless you define it) ?
Why don't you try it?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
| With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |