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 to create a fecelet view?
How do I compare two strings in word in java?
State the main difference between c++ and java?
What is broken and continue statement?
What is the difference amongst jvm spec, jvm implementation, jvm runtime ?
What is the concept of multithreading?
What is a method in programming?
How to invoke external process in java.
What is data type in computer?
What will happen when using pass by reference in java?
How do you sort a list in java?
make a method which any number and any type of argument and print sum of that arguments.....
Why should I use abstract class?
Difference between throw and throws?
Why does java not support pointers?