Java different abstract classes and interfaces

1. An abstract class can have a constructor, interface can not have a constructor. 2. abstract class can have an ordinary member variables, the interface is not an ordinary member variables 3. abstract class may contain non-abstract ordinary methods, all interface methods are abstract must not have non-abstract ordinary method. 4. Access Type abstract methods abstract class may be public, protected, and (default type, the eclipse although not given, nor it should), but the abstract method only public interface type, and the default is the public abstract type. The abstract class variable may contain static methods, static methods can not contain an interface 6. The abstract classes and interfaces can contain static member variables, static member variable access type abstract class may be any, but is only defined in the interface public static final type can be, and is the default public static final type. 7. A class can implement multiple interfaces, but can only inherit an abstract class.

Reproduced in: https: //my.oschina.net/itfanr/blog/195719

Guess you like

Origin blog.csdn.net/weixin_33890499/article/details/91799627