This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Can you UseCodeTags in future? It makes your posts much easier to read, so you're more likely to get a useful reply. I've added them this time.
The question is all about the order constructors get called, and which constructors get called when an object is deserialized. Do you know what the rules are for that? Basically:
- The initial creation of the Dog object prints Animal/Dog, because superclass constructors are called first.
- The constructor of a serializable object is not called when deserializing. But if the superclass is not serializable, its constructor will be called. Change the code to make Animal serializable and you'll notice a change in the output.