Sr.Java Web Developer Question:

Do you know what is composition in Java?

Tweet Share WhatsApp

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 PDF Read All 64 Sr.Java Web Developer Questions
Previous QuestionNext Question
Please explain what is the difference between execute, executeQuery, executeUpdate?What is executeQuery(String query)?