Instance Initializer Block

Hello Guys, I am sure ! you have heard word - static block. But, Have you heard something like Instance Block?

Photo by Afif Kusuma on Unsplash

Instance block is created using the curly braces “{ }”. The main purpose of block is to initialize member variables while creating instance of class.

Please check below Image for how to create instance block :

--

--

Prem Parmar

Prem Parmar

Software Engineer, having 3 years of experience in Ecommerce domain Product based company.