The implement keyword
In java programming language, the keyword implement specifies that the given class implements an interface. Keywords are basically reserved words which have specific meaning relevant to a compiler.
Syntax: Here is the syntax for using the implement keyword in a class.
public class DominoPizza implements Pizza { / write your code here } |
Note: Here are the some point that must be considered while implementing an interface (or interfaces) into a java class.
- A class implementing an interface must either implement all the methods of that interface otherwise known as the abstract class.
- A class in java may extend at most one superclass because java does not allow multiple inheritance, by it may implement more than one interface.
- Multiple inheritance in java is achieved through the interfaces.
- When a class implements more than one interface then
implement statement requires a comma-separated list of interfaces to be
implement by that class.