Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Core java - Interview Questions and Answers for 'Exterro' - 4 question(s) found - Order By Newest | ||||
| ||||
Ans. Java doesn't support multiple inheritance. Interfaces does't facilitate inheritance and hence implementation of multiple interfaces doesn't make multiple inheritance. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
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. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
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. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
![]() | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||