Documentation

The Java™ Tutorials
Hide TOC
Summary of Interfaces接口的小结
Trail: Learning the Java Language
Lesson: Interfaces and Inheritance
Section: Interfaces

Summary of Interfaces接口的小结

An interface declaration can contain method signatures, default methods, static methods and constant definitions. 接口声明可以包含方法签名、默认方法、静态方法和常量定义。The only methods that have implementations are default and static methods.唯一具有实现的方法是默认方法和静态方法。

A class that implements an interface must implement all the methods declared in the interface.实现接口的类必须实现接口中声明的所有方法。

An interface name can be used anywhere a type can be used.接口名称可以在任何可以使用类型的地方使用。


Previous page: Default Methods
Next page: Questions and Exercises: Interfaces