In Java, how access a private static attribute of a child instance from parent method?

Viewed 1973

Here is an example :

class Parent {
    protected int A;

    public void displayA() {
        System.out.println(A);
    }
}

class Child extends Parent {
    protected static int A=2;
}

Child intance = new Child();
intance.displayA();

=> return null !!!

What is the way to retrieve the child attribute from parent method ?

Thank you :)

2 Answers
Related