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 'Java concept' - 4 question(s) found - Order By Newest | ||||
| ||||
| Ans. Composition - has-a relationship between objects. Inheritance - is-a relationship between classes. Composition - Composing object holds a reference to composed objects and hence relationship is loosely bound. Inheritance - Derived object carries the base class definition in itself and hence its tightly bound. Composition - Used in Dependency Injection Inheritance - Used in Runtime Polymorphism Composition - Single class objects can be composed within multiple classes. Inheritance - Single class can only inherit 1 Class. Composition - Its the relationship between objects. Inheritance - Its the relationship between classes. | ||||
| ||||
| Ans. Encapsulation | ||||
| ||||
| Ans. Inheritance | ||||
| ||||
| Ans. Its a facility for code reuse and independent extension wherein a derived class inherits the properties of parent class. | ||||