adspace


What is the reason that multiple inheritance is not possible
in java??

Answer Posted / gayathri

This is to avoid "Diamond problem"....Lets say there are 4 classes A,B,C,D..A is a superclass...The two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C? ...To avoid this issue, Java dint allow multiple inheritance..
Having said that, also note that Java allows multiple inheritance through multiple interface implementation

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between static and non-static methods in java.

1131


Write a program to print count of empty strings in java 8?

1092


explain different ways of using thread? : Java thread

1089


Write a program to find the whether a number is an Armstrong number or not?

1106


Realized?

2272


What is an object in java and how is it created?

1146


What is a classloader in java?

1095


What is java string pool?

1088


Explain public static void main(string args[]) in java.

1084


What is the difference between break and continue statements?

1131


Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example

2672


What is the difference between equals() and == in java?

1047


What are the differences between heap and stack memory in java?

1151


What is parsing in java?

1046


What is a constructor overloading in java?

1131