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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.