prakash pawar wrote:But C++ do have the concept of multiple inheritance how please explain.
When the Java programming language was originally created, the engineers at Sun wanted to create a language that was powerful, but easy to use, especially by people who know C++.
So they created a language that inherited many aspects from C++, but they also left out a number of the more complicated features of C++, one of which is multiple inheritance. One of the difficulties with multiple inheritance is the diamond problem, see the link posted by Seetharaman Venkatasamy above.
In practice, you don't really need multiple inheritance very often.
When Java was created the designers looked at several other languages, including C++. They took what they thought was good, and ignored what at that time they thought would make the language too complex. This includes multiple inheritance, pointers and pointer arithmetic (references are not pointers!), operator overloading and templates, among others. They have changed their minds on templates now with generics added. Because this was done using type erasure this did not require many changes in the language; the compiler is the only one that uses this information. The others would require significant language changes.
Ah, Jesper beat me to it while I was typing this / listening to someone.
It fulfills the contract because both interfaces define a method with the same signature, and the class implements a method with the same signature. It doesn't *matter* which interface is implemented (*not* overridden)--an interface is *just* a contract. The compiler doesn't care *which* show() it is, only that there *is* a show().
The class has a method "void show()" . Each interface is a contract that requires the class to have precisely such a method, so everything is good. When you call the method, there's only one method, so that's the one that's invoked. Don't try to make it any more complex than that -- that's all there is!