Initialization Blocks in Java

Apart from methods and constructors, Initialization Blocks are the third place in a Java Program where operations can be performed. Initialization Blocks come in two flavours:

  • Static Initialization Blocks: Runs first when the class is first loaded. Declared by using the keyword “Static”
  • Instance Initialization Blocks: Runs every time when the instance of the class is created.

Read more

%d