Search Interview Questions
| 2721 questions in repository.|
There are more than 200 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 'Cebs worldwide' - 1 question(s) found - Order By Newest|
|Ans. Earlier any class implementing an interface was supposed to implement all methods declared in an interface. There was no place for optionally implementing all or subset of methods.Though we have abstract classes wherein we could have provided such a mechanism by declaring some methods as abstract while providing definition for some. But as Abstract classes have a body and are comparatively heavier than interfaces and interfaces associate closely to the concept of providing interfacing than abstract classes, Java might have though of providing optional implementation for default methods. This way same interface can be reused in variety of ways rather than making copies of an interface to suit different needs.|
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve java 8 java8 interface default methods default methods Infoview Technologies Oracle Oracle Polska Infosys Tata Consultancy (TCS) CEBS Worldwide|
|Why can't we have diamond problem with interfaces ?|
|What are Default Methods ?|
|If there is a conflict between Base Class Method definition and Interface Default method definition, Which definition is Picked ?|
|Can we have a default method without a Body ?|
|Does java allow implementation of multiple interfaces having Default methods with Same name and Signature ?|
|Can we have a default method definition in the interface without specifying the keyword "default" ?|
|Can a class implement two Interfaces having default method with same name and signature ?|
|What If we make the method as abstract in another Interface ?|
|What if we override the conflicting method in the Class ?|
|What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?|