Implements 是否仅适用于接口?

Does Implements works only with interfaces?

稍微了解了 java InterfacesImplements 让我产生了疑问,

  1. 如果继承仅适用于 类 是 Implements 仅适用于 Interfaces 还是它可能有其他用途?

  2. java 是否必须向我们提供 "built-in" Interfaces 我们可以 Implements 进入我们的程序而不创建它?如果是的话,我在哪里可以找到这些列表。

只能实现接口。

JAVA 有许多内置接口,您可以根据需要实现。

不止一个 class 只能实现一个接口,而它可以扩展多个 class

if Inheritance works only with classes does the Implements work only with Interfaces , or it may has another uses?

继承通常可以通过使用 extends 关键字应用于 classes 接口。也就是说,一个class可以从另一个class继承属性和功能,而一个接口可以从另一个接口扩展其契约义务。

示例:

public interface Phone {
    String getNumber();
}

public interface MobilePhone extends Phone {
    public boolean isSmartPhone();
}

如果要实现上面的 MobilePhone 接口,他们还必须实现 getNumber() 方法。

至于 implements - 与接口一起工作。

Does java has to offer us "built-in" Interfaces that we can Implements into our program without creating it? and if so where i can find a list of those.

它们本身并不是 "built-in";它们是在 Java 中为您预先编写的。 Java API 是寻找第一方接口的最佳位置;但是,值得注意的是,您可以从其他包和框架中获取第三方接口,例如 Spring、Guice 和 Guava,或者从您碰巧包含在项目中的其他开发人员的 JAR。