我有2类,如下概念在继承静态方法
public class statictest {
public void print()
{
System.out.println("first one");
}
}
public class newer extends statictest
{
public void print()
{
System.out.println("second one");
}
}
,并在主函数中我做
statictest temp = new newer();
newer temp2 = new newer();
temp.print();
temp2.print();
输出是:
second one
second one
但是当我做这两种方法静态输出是
firstone
secondone
在这种情况下晚绑定发生了什么?谁能解释
http://stackoverflow.com/questions/4987127/inheritance-in-static-methods?rq=1从这里得到答案 – JATMON
静态方法是没有继承 –
你见过这个... http://stackoverflow.com/questions/10291949/are-static-methods-inherited-in-java –