Interface minus

xiaoxiao2021-03-06  20

Inherit inheritance Use Keywords: Extends Subclass Inherits Super Class, also has all properties in the superclass, including members and methods. That is to say: The hyperclass cannot access the inside of the subclass, including methods and instance variables of subclasses. Subclasses can access methods and instance variables in the superclass. Interface interface Use Keywords: interface to define. The VOID interface can be simply defined in the definition of the interface or the interface. That is, there is only a statement of data and methods. So the method does not exist in the statically common problem that the interface defined in the interface. The interface automatically uses the keywords of Abstract and Final and Static by default. The method in the interface only provides a frame, without providing a method body, so implicitly abstract. The method in the interface is implied in the PUBLIC's Abstract and Non-Static. The keywords that cannot be used when defining methods in the interface are: Static Final Strictfp Native Synchronized. All variables of the interface are public, static, final. Therefore, the variables of the interface cannot be changed, in its implementation class. These keywords may not be written, but the constant quantity must be assigned. The implementation of the interface implementation of the interface must throw the same exception and the method of the interface, which is not a subclass, which is different from Override! Similarly, if the interface method does not throw, the implementation method can not be thrown. Implementation method must be displayed The declaration of the form is public, nothing is not written. The Runnable interface has only one run () method, and no parameters are taken. There is no constructor in the interface. Interface can not be modified with protected and private, unless nested in an interface or class

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

New Post(0)