Home Segments Top Top Previous Next

359: Mainline

Because a class can extend only one direct superclass, Java is said to allow only single inheritance, and to disallow multiple inheritance. If Java did allow multiple inheritance, then you could impose requirements on a class by having that class inherit directly from several abstract classes.

Java does allow a class to implement multiple interfaces, however. Thus, from the perspective of method-definition requirements, you can view Java's interface mechanism as an alternative to multiple inheritance.