Writing in block in java programming.

Program:

//Define a class Block
class Block
{
    static
    {
        // call print function
        System.out.println("hello static");
    }
   
    {
        // call print function
        System.out.println("hello init");
    }
   
    Block()
    {
        // call print function
        System.out.println("hello default constructor");
    }
   
    // call print function
    public static void main(String args[])
    {
       
        Block a=new Block();
    }
}



Sample output:

Post a Comment

Previous Post Next Post