CS4282/CS6282 Internet and Distributed Systems Programming
Doug Lea : Concurrent Programming in Java
notes on page 9
Why use interface?
1. An interface encapsulates a coherent set of services and attributes (broadly, a role) without assigning this functionality to any particular object or code.
2. Interface are more abstract than classes since they say nothing at all about representations or code.
3. All they do is describe the signatures (names, argument, result types, and exceptions) of public operations, without even pinning down the classes of the object that can perform them.
4. The classes that can support Runnable typically have nothing in common except that they contain a run method.
Keine Kommentare:
Kommentar veröffentlichen