No. An interface does not include instance variables. (But can include constants.)
An interface looks like this:
interface InterfaceName { constant definitions method headers (without implementations). }
A method header is
an access modifier, a return type, the method name, a parameter list followed by a semicolon.
An interface is best put in its own source file ending with the extension .java
The methods in an interface are public
by default,
so you can omit public
from the method headers.
An interface looks somewhat like a class definition. But no objects can be constructed from it. You define a class that implements an interface, and then construct objects of that class.
A class implements an interface by doing this:
class SomeClass extends SomeParent implements InterfaceName { }
A class extends just one parent, but may implement several interfaces.
May a class define methods in addition to those listed in an interface?