What will be output of following java program? (Static Interview Question)

class StaticBlock

{

                int a;

                static     //Static Block

                {

                                System.out.println("Class StaticBlock is Loaded");

                }

                public StaticBlock()

                {

                                System.out.println("Class StaticBlock is Instantiated");

                }

                public static void main(String arg[])

                {

                                new StaticBlock();

                                new StaticBlock();

                }

}

Static Block & Constructor.PNG

, , , , , , , ,

Leave a Reply