Is there a complete list of order of initalization for a class in this book?
I think it is something like this:
The order of initialization of a class is:
1. All static constants, variables and blocks.(Among themselves the order is the order in which they appear in the code.)
2. All non static constants, variables and blocks.(Among themselves the order is the order in which they appear in the code.)
3. Constructor.
Actually, Section 9.3.1 discusses the object initialization (i.e. order of initialization of an object of a class) and not class initialization. The two are different. Class initialization happens only the first time that a class is used and not every time that an object of that class is created.
Class initialization is discussed in Section 8.3.6.
Based on your query, I have requested the author to improve this section by including the situation where a class has a superclass as well.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.