interface A
{
public void f();
public void g();
}
class B implements A
{
public void f()
{
System.out.println("B.f()");
}
}
public class Main
{
public static void main(String[] args)
{
B tmp = new B();
tmp.f();
System.out.println("B.f()");
}
}
我没有在 B 中的接口 A 中实现所有方法,并且它有一个错误
The type B must implement the inherited abstract method A.g()
但为什么它可以得到输出
B.f()
B.f()