Is java supports multiple inheritance? explain?

Answer Posted / krishna kumar g.

Java doesn't supports Multiple Inheritence.
Let see the example.
class A
{
void m1()
{
// some code
}
}
class B
{
void m1()
{
// some code
}
}
class C extends A,B
{
void m2()
{ }
public static void main(String[] args)
{
C c=new C();
c.m1();
}
}
If we want to call m1() by using class C object, then
which class method(m1()) will be called.It is unable to
find the which class method(m1()) will be called.
So multiple Inheritence is not posssible.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the default size of set in java?

698


What is the parse method in java?

778


What is natural ordering in java?

720


When should I use a singleton?

762


What is the replace tool?

749


What do you understand by a Static Variable?

878


What is the common usage of serialization? What exceptions occur during serialization?

799


which pattern is default in scanner package?

1988


how to deploy tomcatserver to weblogic server? write d following steps?

1654


Can a static member function access member variable of an object?

746


How do you use parseint in java?

704


What are latest features introduced with java 8?

803


does java support pointers?

743


What is the difference between Java1.4 and Java1.5

2046


What's the purpose of using break in each case of switch statement?

723