How multipleInheritance is possible in java?

Answer Posted / pradeep panwar

Hi all, This is Pradeep...
I am confused by the java statement that "By using
interface we can achieve multiple inheritance bcoz java
doesn't support Multiple inheritance".
Yes.Ok java doent support Multiple inheritance. Now we know
that inheritance means that "one object acquires the
property of another object".
So how can it is possible achieve Multiple inheritance by
interface.
Interface that contains just undefined methods like below
code.

interface Member1
{
public void eye();
public void nose();
public void mouth();
}
interface Member2 extends member1
{
public void neck();
public void hand();
public void stomach();
}
interface Member3 extends Member1,Member2
{
public void leg();
}

class Man implements Member3
{
public man()
{
Member3 ref=new Man();
}
// Here Implements all 7 methods.
}


/*
Is the above code defines multiple Inheitance?
undefined methods are eye,nose,mouth,neck,handand stomach
are fall in Interface Member3 .Yes. But Inheritance means
that one object acquires the property of another
object.Property means that code and data.
In here, there is no code just declarations of method which
is not to be a code .
So How can we say interface achieve multiple inheritance.
Please any one explain and clear my doubt with simple
example.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is object-oriented programming?

570


How do you sort in ascending order in java?

522


What is abstract class constructor called?

571


Difference between arraylist and hashset in java?

547


what is object-oriented programming in java?

589






Can you add null to a list java?

585


What does I ++ mean?

611


Why vector is used in java?

558


Why is java multithreaded?

542


How to split arraylist elements in java?

601


Explain treeset?

593


Write a program to calculate factorial in java?

583


What is assembly used for?

506


What are the 5 types of research methods?

589


What is method in research paper?

575