When an interface inherits other interfaces, any class that implements that interface must implement all of the methods declared by that interface and the inherited interfaces. For example, if a class implements the ProductDAO class, it must implement all of the methods defined by the ProductReader and ProductWriter classes. If it doesn't, the class must be declared as abstract so that no objects can be created from it.
I don't understand that last sentence. Why does it make it ok for a class to implement an interface but not its methods when it's declared abstract? What does the inability of creating objects from this class have to do with implementing methods from its implemented interfaces?
It means the concrete classes extending your abstract class will have to implement the interface methods if they aren't already implemented in the abstract class. You can implement some of the interface methods in your abstract classes, the rest will have to be implemented in your concrete classes extending the abstract class.
You can create instances of abstract classes, but by indirect routes.
You know that abstract classes are allowed abstract methods? Well, the unimplemented methods in interfaces are abstract methods. If you create an object you must implement them, so whenever you create a concrete subclass of an abstract class (or an anonymous class), you must implement all its methods. You can create instances of the concrete subclasses directly, so they must have all methods implemented.
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad: