The interface used in java is the one that defines only the types of variables and methods without describing the specific processing contents of the methods included in the class. Declare and implement the interface as follows:
//Interface declaration
interface Interface name{
}
//Interface implementation
class class name implements interface name{
}
Since the specific processing content of the method is not described in the interface, it can be used by describing only the method type first and then describing the processing content immediately before using the method.
In class inheritance, there was only one superclass to inherit from, but the interface has no such restrictions. You can create a new interface by inheriting multiple interfaces.
Recommended Posts