Section 10.9 Creating and Using Interfaces

• An interface (p. 421) specifies what operations are allowed but not how they’re performed.

• A Java interface describes a set of methods that can be called on an object.

• An interface declaration begins with the keyword interface (p. 421).

• All interface members must be public, and interfaces may not specify any implementation details, such as concrete method declarations and instance variables.

• All methods declared in an interface are implicitly public abstract methods and all fields are implicitly public, static and final.

• To use an interface, a concrete class must specify that it implements (p. 421) the interface and must declare each interface method with the signature specified in the interface ...

Get Java™ How To Program (Early Objects), Tenth 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.