Difference between interface and abstract class in Java

The first point: the modifiers are different: the interface uses the Interface abstract class uses the abstract

The second point: abstract classes can have constructors, interfaces cannot have constructors

The third point: the abstract class can have ordinary member variables, the interface cannot have ordinary member variables, and the member variables in the interface       are public static final by default.

The fourth point: abstract classes can have ordinary member methods, and interfaces can only have unimplemented abstract methods.

The fifth point: the default modifier of abstract methods in abstract classes is public or Protected, while those in interfaces can only be                      public

The sixth point: abstract classes can contain static methods, but interfaces cannot contain static methods.

Seventh point: a class can implement multiple interfaces but only inherit one class.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325643151&siteId=291194637