- - First reason is ambiguity around Diamond problem occurs.
- - multiple inheritances does complicate the design and creates problem during casting, constructor chaining etc
- - Since interface only have method declaration and doesn't provide any implementation there will only be just one implementation of specific method hence there would not be any ambiguity.
Example :
- - multiple inheritances does complicate the design and creates problem during casting, constructor chaining etc
- - Since interface only have method declaration and doesn't provide any implementation there will only be just one implementation of specific method hence there would not be any ambiguity.
Example :
- class A{
- void msg(){System.out.println("Hello");}
- }
- class B{
- void msg(){System.out.println("Welcome");}
- }
- class C extends A,B{//suppose if it were
- Public Static void main(String args[]){
- C obj=new C();
- obj.msg();//Now which msg() method would be invoked?
- }
- }