java - 如何调用祖父类中被覆盖的方法?
怪我咯
怪我咯 2017-04-17 15:33:36
0
1
414
public class one
{
    public void hello()
    {
        System.out.println("one");
    }
}

public class two extends one
{
    @Override
    public void hello()
    {
        System.out.println("two");
    }
}

public class three extends two
{
    @Override
    public void hello()
    {
        //如何调用one中的hello方法
    }
}

怎么在three()中调用one的方法了,突然想到了这个问题,google了以后发现没有好的方法或者说是无法实现,这里应该是不能调用super关键字来实现的,java初学者.

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
黄舟

The answer is No

The implementation of your expectation is very strange, you may want to reconsider the design of your program structure

A class is an abstraction of a type of affairs with the same characteristics. If your three subclass does not have the characteristics of the two parent class, then it should not be a subclass of the two parent class, but should

that becomes a subclass of one
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!