Sunday, 26 September 2010

Multiple Inheritance in Java

In Java a class can be derived from only one base class. That is, the following declaration is not allowed:
class C extends A, B // Wrong;
{
}
Nevertheless, it is possible for a class to extend a base class and to implement one or more interfaces:
class C extends A 
implements D, E
{
}
 
The derived class c inherits the members of A and it implements all the methods defined in the interfaces D and E.

Inheritance among interfaces in java

No comments:

Post a Comment