Java note 5

xiaoxiao2021-03-18  194

interface

The definition of the interface is similar to the class, but there is no member variable in the interface, where the definition method is just a frame without a specific implementation.

During the implementation of the class to the interface, all methods in the interface must be implemented. The features of multiple interfaces can be implemented so that there is no more inheritance that is not defined in Java.

It is generally believed that the interface is a collection of multiple unprecedented methods. Note: 1. The modification type of the variable in the interface is implied with the Final and Static types, which cannot be changed by the class. 2. The access type of the variable in the interface depends on the type of access to the interface. If the interface is defined as a PUBLIC type, the variables in the interface are also public types. 3. In the definition of the class to interface, all methods in the interface must be implemented. This implementation is "relative", which can provide both implementation of the code for the method in the interface, or may not provide code. If you do not provide code, you must write the framework of the method. If all methods in the interface are not fully implemented, this class must be defined as an abstract type.

转载请注明原文地址:https://www.9cbs.com/read-129957.html

New Post(0)