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


Please Help Members By Posting Answers For Below Questions

How do you reverse a word in java?

525


What is role of void keyword in declaring functions?

566


When do we need to use internal iteration? When do we need to use external iteration?

599


What is collection class in java? List down its methods and interfaces.

519


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

1725






What are the parts of a method?

531


What is a pattern what is an anti pattern?

501


What is command line used for?

581


What happens when you add a double value to a string?

535


Is main is a keyword?

571


What is your platform’s default character encoding?

551


What is java and its types?

547


What is scanner in java?

532


Explain notifyall() method of object class ?

662


What are the advantages of unicode?

540