我感到困惑的是,在贾瓦邦的所作所为之下,我知道,在贾瓦,不可能出现静态继承,那么我如何能够呼吁A的B类固定成员?
public class A {
static int staticVariable = 5;
public static void staticMethod(){
System.out.println("A");
}
}
public class B extends A{}
public class C {
public static void main(String[] args) {
A.staticMethod();
B.staticMethod();
System.out.printf("A s int value %d and B s int value is %d",A.staticVariable,B.staticVariable);
}
}
产出:
A
A
A s int value 5 and B s int value is 5