Interface Example -- Implementing Storable
A class may implement an interface, in which case it provides the body for the methods specified in the interface.
interface storable has store and retrieve methods
- public class Picture implements Storable {
- public void store(Stream s) {
- // JPEG compress image before storing
- }
- public void retrieve(Stream s) {
- // JPEG decompress image before retrieving
- }
- }
- public class StudentRecord implements Storable {