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 do you reverse a word in java?
What is role of void keyword in declaring functions?
When do we need to use internal iteration? When do we need to use external iteration?
What is collection class in java? List down its methods and interfaces.
what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent
What are the parts of a method?
What is a pattern what is an anti pattern?
What is command line used for?
What happens when you add a double value to a string?
Is main is a keyword?
What is your platform’s default character encoding?
What is java and its types?
What is scanner in java?
Explain notifyall() method of object class ?
What are the advantages of unicode?