0
I think you are talking about static initialization blocks and instance initialization blocks. Static blocks are executed at the time of class loading and are executed only once. Instance blocks are executed every time a new object of the class is created. This is one example I wrote sometime back https://code.sololearn.com/c3axnS70ry5v/?ref=app https://code.sololearn.com/c9Yo6f7roK2N/?ref=app
22nd Mar 2020, 6:58 PM
Avinesh
Avinesh - avatar