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 are byte codes?

843


What is the major drawback of internal iteration over external iteration?

781


Why volatile is used in java?

722


Is alive method in java?

706


What is stringreader?

693


What is a local block?

874


Can you run java program without main method?

764


Is null == null in java?

842


How to avoid memory leak in java?

812


How does linkedlist work in java?

687


Explain the significance of listiterator.

762


What is difference between iterator access and index access?

835


How can the checkbox class be used to create a radio button?

728


Explain the difference between extends thread vs implements runnable in java?

788


Can a final variable be initialized in constructor?

681