Header Ads

  • Breaking Now

    What is static initializer code?

    A class can have a block of initializer code that is simply surrounded by curly braces and labeled as static e.g.
    public class Demo{
    static int =10;
    static{
    System.out.println("Hello world');
    }
    }
    And this code is executed exactly once at the time of class load.

    Post Top Ad

    Post Bottom Ad