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
List some important characteristics on jre
What are the different types of sorting in java?
Explain what pure virtual function is?
how come we know the object is no more used in the class?
What is the preferred size of a component in java programming?
What is integers and example?
What is meant by vector class, dictionary class, hash table class, and property class?
Will minecraft java be discontinued?
What are java packages?
how can you catch multiple exceptions in java?
How do you check if a character in a string is a digit or letter?
Can substring create new object?
What is a flag and how does it work?
How does arraylist size increase in java?
Differentiate between run time error and syntax error.