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
What happens if main method is not static?
What is split return?
How do you sort a string in java?
Is a copy constructor?
Why is singleton not thread safe?
Explain what are final variable in java?
Can we initialize the final blank variable?
How to declare an arraylist in java?
What is mean by collections in java?
Write a program to find the greatest of three numbers in java?
Write a program in java to create a doubly linked list containing n nodes.
Can we have any code between try and finally blocks?
What does it mean to be immutable?
Differences between external iteration and internal iteration?
What is array initialization in java?