Wednesday 28 August 2013

IIB

it stands for Instance Initialization Block.
IIB doesn't have any keyword , identifier or label.
A class can have any numbers of IIB.
when we create the object of the class first it executes the IIB then perform another operation.
if we create 3 object of the class then IIB will executes 3 times .The execution of IIB depends on the number of object creation.
first executes the IIB after this it executes the constructor.

Example:-


we create the object 2 times lets see what happen

it prints 2 times.
NO matter how many IIB program  contains , at the time of object creation it will print all the IIB present in the program
No matter where IIB present after the main or before the main it prints all the IIB.
Order of IIB execution is from top to bottom.







No comments :

Post a Comment