Abstract classes and interfaces are the two Java tools for abstraction (see 3.7). Both let you write code against a general type and leave the details to other classes.
Key words in this topic
- Abstract class: a class marked
abstractthat cannot be instantiated and may contain abstract methods. - Abstract method: a method with no body, which every concrete subclass must implement.
- Concrete class: an ordinary class that can be instantiated, with every method complete.
- Interface: a contract listing methods that a class promises to provide.
- implements: the keyword a class uses to take on an interface.