interface
The interface keyword is used in the declaration of an interface. An interface can be thought of as a template for a class that you may need to implement, but you don't have to do all the design work yourself.
Interfaces differ from classes in the following ways:
-
Interfaces cannot implement other interfaces. (They may extend other interfaces.)
-
Interfaces cannot contain constructors, instance variables, class methods, or static class initializers.
-
All methods declared within an interface are implicitly declared to be public and abstract. Methods within an interface cannot be declared as final, native, static, or synchronized.
-
All variables declared within an interface are implicitly declared to be static and final, and thus, must be assigned a constant value. Variables are also implicitly public, and cannot be declared as either transient or volatile.