接口和抽象类广告方法覆盖 [英] Interface and Abstract class ad method overriding

查看:26
本文介绍了接口和抽象类广告方法覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码如下:

interface hi
{
    public void meth1();
}
abstract class Hullo
{
    public abstract void meth1();
}
public class Hello extends Hullo implements hi
{
    public void meth1(){}
}

问题:代码编译和一切.我想知道 Hello 类中的 meth1() 覆盖了哪个 meth1()?接口中的ont还是抽象类中的ont,为什么?

Question:The code compiles and everything. I wanted to know the meth1() in class Hello is overriding which meth1()? The ont in the interface or the one in the abstract class and why?

推荐答案

答案很简单:两者都......

The answer is short: Both.....

事实上,正确地说:您没有覆盖它们中的任何一个,而是使用一种方法实现它们.

In fact, to be correct: You are overriding none of them, you are implementing them both, with one method.

这篇关于接口和抽象类广告方法覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆