Variable and Method shadowing in Java
问题 Basically I would like to know why a static method cannot be shadowed by an instance method, (I know why, it will lead to ambiguity in certain circumstances), whereas a static variable can be shadowed by an instance variable (it applies only for subclasses). Example: public class Apartment{ static int area = 10; public static int getArea(){ return area; } } class BedroomFlat extends Apartment { int area = 10;// no problem at all public int getArea(){ // illegal line it cannot hide the super