In multiple Inheritance,ex: class A, Class B inherited from Class A, Class C inherited from class A, Class D inherited From Class B,and Class C.in this Class D have dual copy of the methods ,datamembers defined in Class A, Vertual Function Is there in C++ but,again the pointer are not used in java. So to avoid this ambiguity, only single chain inheritance is there, not multiple inheritance.
Multiple inheritance will cause ambiguity in Java if any two different classes have the same method. The necessity of Multiple Inheritance is catered using Interfaces
The first part of this question is ill-formed. Polymorphism is a concept and a feature of many object oriented languages, including Java, that support handling multiple data types through a uniform interface. The question implies that there is something special that must be done to use polymorphism when implementing an interface. Any time an interface is implemented the implementation itself is intrinsically an application of polymorphism.
The generally accepted explanation of why Java does not support multiple inheritance is that the language designer's wanted to keep the language simple and the complexities introduced by multiple inheritance would defeat that desired simplicity.
interface MyInterface{ public void HiMsg(); } public class MyClass implements MyInterface{ public void HiMsg(){ System.out.println("Hi Guys"); } } Class PolyWithInterface{ public static void main(String args[]){
MyInterface myInterface = new MyClass(); myInterface.HiMsg();