java interface, abstract class, polymorphism

interface

Use the interface keyword definition.
Use the implement keyword to achieve multiple implementations.
Features: Interfaces cannot create objects. Before 1.8, there can only be abstract methods. Implementation classes must rewrite all abstract methods

Abstract method: Use the abstract keyword to declare a method as an abstract method. In an interface class, the method defaults to an abstract method.

Define the interface (interface)

public interface USBInterface {
   
    
    
	public abstract void install();
	void work()

Guess you like

Origin blog.csdn.net/Mwyldnje2003/article/details/106973930