Chapter 9. Interfaces

 

My apple trees will never get acrossAnd eat the cones under his pines, I tell him.He only says “Good Fences Make Good Neighbors.”

 
 --Robert Frost, Mending Wall (1914)

An interface declaration introduces a new reference type whose members are classes, interfaces, constants and abstract methods. This type has no implementation, but otherwise unrelated classes can implement it by providing implementations for its abstract methods.

A nested interface is any interface whose declaration occurs within the body of another class or interface. A top-level interface is an interface that is not a nested interface.

We distinguish between two kinds of interfaces - normal interfaces and annotation types.

This chapter discusses the common semantics ...

Get Java™ Language Specification, Third Edition, The 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.