karthik rsn wrote:can anyone clearly explain me about multiple inheritence.., syntactically it is allowed but conceptually it's not.., so please send in u'r replies..,
Both a class and an interface represents a type. The difference is that a class can carry implementation but an interface cannot.
Now the Java inheritance model supports multiple inheritance of type but only single inheritance of implementation. So Java allows a class to inherit one class at the most but an unlimited number of interfaces. An interface can inherit an unlimited number of interfaces.
In OO design the inheritance of type is considered most important and here Java imposes no restrictions. Java supports multiple inheritance of type.
When it comes to inheritance of implementation Java imposes a restriction. At the most one implementation can be inherited. The reason for this limitation, given in the Java Programming Language by Gosling and others, is problems associated with so called diamond inheritance.
In practice multiple inheritance of implementation, although not supported by Java, can be simulated. This is done by splitting up the class to be inherited into one interface that's inherited and one implementation class that's delegated. The only drawback is that it requires more writing.
So in summary, Java supports multiple inheritance of type, the most important form of inheritance in OO design. Java supports single inheritance of implementation only, but multiple inheritance of implementation can easily be simulated.