Java는 그러한 정규화를 허용하지만 그러한 액세스는 상속과 재정의가 미묘하게 혼동되고 있음을 나타낼 수 있습니다.
예:
class Parent {
static int foo = 0;
}
class Child extends Parent { }
void bar() {
System.out.println(Child.foo);
}
빠른 수정이 적용된 후 결과는 다음과 같습니다.
class Parent {
static int foo = 0;
}
class Child extends Parent { }
void bar() {
System.out.println(Parent.foo);
}