The differences are as follows:
1. Abstract classes can have abstract methods or instance methods; all methods in the interface are public abstract methods.
(Video tutorial recommendation: java video)
2. Subclasses use the extends keyword to inherit the abstract class, and subclasses use the implements keyword to implement the interface. Subclasses that implement an interface must override all methods in the interface.
3. Abstract classes can have their own constructors, but interfaces cannot have constructors.
4. A concrete class can only extend one abstract class and can implement multiple interfaces.
Recommended tutorial: java entry program
The above is the detailed content of What is the difference between java interface and abstract class. For more information, please follow other related articles on the PHP Chinese website!