SIB,IIB and Examples on SIB and IIB

SIB – Static Initialization Block SIB executes when the class gets loaded and executes only once in entire execution IIB – Instance Initialization Block IIB executes when the constructor is called but before the execution of constructor. So it executes as many times as constructor gets executed. Let’s see the example package com.kb.instanceblock;   public […]

Share this article on

Constructor Chain

As we all know that Constructor in java always executes when we create an object. But what is the order of execution of constructors when we have parent child relationship ? Always constructor’s default first statement is super(); which means it calls super class constructor. Let’s see it with an example Example1.java package com.kb.constructorchain;   […]

Share this article on
< Previous Next >