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?
Karuppiah Subramaniyam wrote:
Abimaran Kugathasan wrote:
Karuppiah Subramaniyam wrote:here the incremented value of k (2) only should get printed right?
Welcome to JavaRanch! Don't you go through the thread? printed value 1, as in the 1st code.
Ya I have gone through the thread. And I am also getting the same answer.But logically speaking after the multiplication , the value of k will get incremented by 1.Where that value will be?
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.
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.. . . .
Any expression involving an int and/or a primitive lower than int (byte, short) will always result in an int.