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
Can we extend immutable class?
What is method overloading and method overriding?
What is java and their uses?
Can you have two constructors in java?
Explain the importance of throwable class and its methods?
What is the base class of all exception classes in java?
What are the different conditional statements?
What do you mean by inner class in java? Explain
How do you compare arrays in java?
What is the synonym of string?
can rmi and corba based applications interact ?
Differences between C and Java?
What do you understand by an io stream?
How does hashset work in java?
Can I import same package/class twice?