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 ...

Get Java: An Introduction to Problem Solving and Programming, 8th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.