Unlock the Power of Open Source! The " Linux New " SWAYAM Plus Course is live now and about 2,500 learners have already registered for it.

If you are a registered learner, the forum page is now active. Visit the page and get all your questions answered.

Non static block - English

13214 visits



Outline:

Non-static block Any code written between two curly brackets Executed for each object that is created Executes before constructor's execution can initialize instance member variables of the class create a class named NonStaticTest Create a non-static block and a constructor inside it Check the output Include multiple non-static blocks they will be executed in the sequence in which they appear in the class Check the output Non-static block is not a substitute for constructor