is the initialization happens in this order?

The order of variable initiation is the following:
1) Static variable/methods are initialized first.
2) The object.
3) Object variables.

Recommended Answers

Yes, with the caveat that sometimes static initialization is delayed until it is needed. You can see this effect by playing with static constructors and derived classes.

Jump to Post

All 2 Replies

Yes, with the caveat that sometimes static initialization is delayed until it is needed. You can see this effect by playing with static constructors and derived classes.

i know the example. thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.