In Java, the interface keyword is used to declare an interface:

interface Vehicle {
    void start();
    void stop();
}

Interface is a programming construct that defines a contract which must be adhered by implementing classes. The methods defined in an interface must have no body and end with a semicolon. The implementing classes will provide concrete implementation for the methods.

Related keywords: class and implements. See all Java keywords.

 

Related Topics:

 

Other Recommended Tutorials:


About the Author:

is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.



Add comment