How multipleInheritance is possible in java?
Answer Posted / srikanth
Multiple Inheritance is possible in java through interfaces only. Where as in C++ it is possible through classes also. Because in C++ there is one operator called scope Resolution operator, by this we can uniquely call one method of super classes. But we have no such operator in java, so it is not possible for a class to be inherited from multiple classes but possible with interfaces. For example,
class MyClass implements interface1,interface2....
{
// code
}
One more thing is, we can define our class from combination of interface and class also. But, combination should contain only one class and one or more interfaces. Ultimately class should be inherited from one class only.
class MyClass extends Class1 implements interface
{
//code
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is arraylist a class in java?
What is meant by class and object in java?
how can i use a nonsynchronized hashtable?
what is object slice?
This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }
How to convert string to char and vice versa?
What does java edition mean?
Is main is a keyword?
What are the advantages of exception handling?
What is field name?
What is bifunction in java?
What is substring 1 in java?
What is string manipulation?
What is the file extension for java?
How to make object serializable in java?