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 is runtime polymorphism or dynamic method dispatch?
Why should we use singleton pattern instead of static class?
What is structure of java heap? What is perm gen space in heap?
Can we override tostring method in java?
How does map works in java?
Explain about static nested classes in java?
What is java thread dump, how can we get java thread dump of a program?
Assume a thread has lock on it, calling sleep() method on that thread will release the lock?
How are destructors defined in java?
How do you take thread dump in java?
take an array with -ve and +ve value both.find out the nearest value of 0(zero).if two values are same like(-2 and +2)then extract +2 is nearest of 0(zero).
What is instance example?
Explain about the dynamic behavior of core java?
What are the basics of core java?
Difference between static and dynamic class loading.