Explain the order of initialization when an object is instantiated.

Last updated 5 July 2026

  • Static fields and static blocks run once when the class is first loaded, before any instance exists.

  • Per instance: memory is zeroed, superclass constructors run first up the chain, then field initializers in source order, then the constructor body.

  • Calling an overridden method from a base constructor is a classic bug because derived fields aren't initialized yet.

  • https://learn.microsoft.com/en-us/answers/questions/462106/in-what-order-do-things-happen
  • https://www.geeksforgeeks.org/java/order-of-execution-of-initialization-blocks-constructors-in-java/
All Object-Oriented Programming interview questions