mardi 2 août 2016

Static method in inheritance

class A
{
    static{
        get();
    }
    static void get(){
        System.out.println("HELLO");
    }
}

class B extends A
{
    public static void main(String[] args) {

    }
}

Output:

HELLO

How is static method of class A getting called. I can understand static method of B getting called but not of A.

Aucun commentaire:

Enregistrer un commentaire