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
How list contains works in java?
why doesn't java run on all platforms?
Tell me are there implementations for sorting and searching in the java libarary?
Which data type is a class in java?
What are wrapped classes in java programming?
Explain the term virtual machine?
What is thread synchronization in java?
What is data type modifier?
What do you mean by inner class in java? Explain
Can a class be private in java?
Why main function is static?
Explain the difference between abstract class and interface in java?
Which package is always imported by default?
What does int [] mean in java?
In the below example, what will be the output?