What is non static block in java?
Any code written between a { and a } is a non-static block.
For example: {
// some code goes here
}
The non-static block code is executed when a new class is instantiated. It executes before the constructor’s execution. Apart from initialization, any other execution like calculation could be given in the non-static block, as a constructor is used for initializing purpose.