为什么静态方法不能在java中重写

时间:2011-12-04 16:25:39

标签: java

  

可能重复:
  Why doesn't Java allow overriding of static methods?

 public class Start extends a{
    @Override
   static void f()//this shows up as an error in eclipse
    {
        System.out.println("child class");
    }
    public static void main(String[] args) {

a.f();
Start.f();
    }

}
class a
{    
    static void f()
    {
        System.out.println("parent class");
    }
}    

为什么java不支持静态方法覆盖.....当我使用注释时它肯定指出静态方法无法覆盖....请给我一个简单的解释

0 个答案:

没有答案