Sr.Java Web Developer Question:

Download Job Interview Questions and Answers PDF

Do you know what is composition in Java?

Sr.Java Web Developer Interview Question
Sr.Java Web Developer Interview Question

Answer:

Composition is again specialized form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object dose not have their lifecycle and if parent object deletes all child object will also be deleted. Let’s take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different house if we delete the house room will automatically delete.

Download Sr.Java Web Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Please explain what is the difference between execute, executeQuery, executeUpdate?What is executeQuery(String query)?