What will happen, when the main of class is not defined in the class of a program in java?

Program:

// define class without main
class Withoutmain
{
    // static is predefined keyword
    static
    {
      //calling printf function
      System.out.println("hello static block");
    }

}


Sample Output:


Post a Comment

Previous Post Next Post