Comparison of Interface and Abstract class in Java language

xiaoxiao2021-03-05  32

Rereading Java, simple comparison for Interface and Abstract class

Similarly: 1. All "implementation", the Abstract class can have an Abstract method with the Abstract class, which does not implement some. 2. Butterface and Abstract classes cannot be used directly to establish an object instance, must Inherited by a standard "general class" to achieve the part that is not implemented, then use "general class" to establish an object instance. Different points: 1. Butterface does not construct a constructor, the Abstract class has a constructor. 2. Interface does not allow any way to have an implementation section, but the Abstract class allows a general non-Abstract method that must be implemented .3. Interface does not have built-in Super and this variables, the Abstract class has .4.interface members The variable results must be constant. The member variables of the Abstract class are general variables. 5. All member package rating is public, and the members of the Abstract class can be any package level.

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

New Post(0)