Interfaces
Objectives
Applied
- Create and implement an interface and use the resulting class in an application.
- Create a class that inherits another class and implements one or more interfaces.
- Create an interface that inherits other interfaces.
- Implement the Cloneable interface for any classes that you've created and then use those classes in an application.
- Given the Java code for an application that uses any of the language elements presented in this chapter, explain what each statement in the application does.
Knowledge
- In general, explain how interfaces work.
- Describe two advantages of using an interface over using an abstract class.
- Name two general-purpose interfaces defined by the Java API and explain what they do.
- Explain how you can use interfaces and the factory pattern to separate the presentation layer of an application from the database layer.
- Describe two ways that you can use an interface as a parameter.
- Explain the difference between a mutable object and an immutable object.