Understanding Blocks in Java

Java provides several ways of instantiating objects / classes. One of the most interesting features being blocks.
Java gives you an option to create two types of blocks –

  • Initializer blocks
  • Static blocks

Initializer blocks popularly known as Instance initializers are used to do something when an Object is created. Simple program below demonstrates a block :
[ad#in-blog]
Complete post!