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
If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?
Can we override constructors in java?
Can you instantiate the math class?
What is the purpose of format function?
what is the major difference between linkedlist and arraylist in java?
I want to store more than 10 objects in a remote server? Which methodology will follow?
What is the internal implementation of set in java?
Explain about public and private access specifiers?
How many classes can any class inherit java?
What is the difference between abstract classes and interfaces?
List the features of java programming language.
Explain the importance of thread scheduler in java?
Have you ever used hashtable and dictionary?
What is the use of arrays tostring () in java?
what is difference between equals and ==?