Chapter Summary
A Java interface contains the headings of public methods and the definitions of public named constants. It does not declare constructors or private instance variables.
A class that implements an interface must define a body for every method that the interface specifies. It might also define methods not declared in the interface. A class can implement more than one interface.
An interface provides a way for a class designer to specify methods for another programmer. By implementing an interface, a programmer can guarantee that a class defines certain methods.
An interface is a reference type, and so you can declare variables and method parameters as having an interface type.
You can extend an interface to create an interface that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access