Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'Ample softwares' - 2 question(s) found - Order By Newest | ||||
| ||||
Ans. class A { void test() { System.out.println("test() method"); } } class B { void test() { System.out.println("test() method"); } } Suppose if Java allows multiple inheritance like this, class C extends A, B { } A and B test() methods are inheriting to C class. So which test() method C class will take? As A & B class test() methods are different , So here we would Facing Ambiguity. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  multiple inheritance  object oriented programming (oops)  oops concepts  diamond problem Asked in 20 Companies basic   frequent | ||||
| ||||
Ans. There was no multiple inheritance in java before version 8 as implementing multiple interfaces cannot be termed as inheritance. With Java 8 , came the concept of default methods wherein the class implementing the interface carries the default implementation from the interface and hence facilitating multiple inheritance. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  multiple inheritance  object oriented programming (oops)  oops concepts   inheritance  object oriented programming (oops)  oops concepts   oops concept Asked in 10 Companies   frequent | ||||
Related Questions | ||||
What are the difference between composition and inheritance in Java? | ||||
Why every object constructor automatically call super() in Object before its own constructors? | ||||
How compiler handles the exceptions in overriding ? | ||||
Difference between Composition and Inheritance ? | ||||
Which of the following Java feature promotes access protection or Hiding ? a. Inheritance b. Encapsulation c. Abstraction d. Composition | ||||
Which of the following is tightly bound ? Inheritance or Composition ? | ||||
Does a class inherit the constructor of its super class? | ||||
What is Maven's order of inheritance? | ||||
Can we compose the Parent Class object like this ? | ||||
What is Maven's order of inheritance? | ||||