Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

is there a concept of aggregation(weak) and composition in Javs similar in lines to C++.
- srini
what is class composition in java.how it differ from object composition. please…explain
- Vishv Deepak
To have more clarity on Why composition should be favored over inheritance, Please read efectivejava.blogspot.in/2013/07/item-16-favor-composition-ovr.html
- manoj
Hi, what is the difference between aggregation and composition ?
- Farrukh
A relationship defines the connection between objects. This explains how objects are connected to each other’s and how they will behave. Association It represents a relationship between two or more objects where all objects have their own lifecycle and there is no owner. The name of an association specifies the nature of relationship between objects. This is represented by a solid line. Let’s take an example of relationship between Teacher and Student. Multiple students can associate with a single teacher and a single student can associate with multiple teachers. But there is no ownership between the objects and both have their own lifecycle. Both can be created and deleted independently. Aggregation It is a specialized form of Association where all object have their own lifecycle but there is ownership. This represents “whole-part or a-part-of” relationship. This is represented by a hollow diamond followed by a line. Let’s take an example of relationship between Department and Teacher. A Teacher may belongs to multiple departments. Hence Teacher is a part of multiple departments. But if we delete a Department, Teacher Object will not destroy. Composition It is a specialized form of Aggregation. It is a strong type of Aggregation. In this relationship child objects does not have their lifecycle without Parent object. If a parent object is deleted, all its child objects will also be deleted. This represents “death” relationship. This is represented by a solid diamond followed by a line. Let’s take an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room cannot belongs to two different house if we delete the house room will automatically delete. Let’s take another example of relationship between Questions and options. Single questions can have multiple options and option cannot belong to multiple questions. If we delete questions options will be automatically deleted. Dependency It represents a relationship between two or more objects where an object is dependent on another object(s) for its specification or implementation. This is represented by a dashed arrow. Let’s take an example of relationship between client and service. A client is dependent on the service for implementing its functionalities. Let’s take another example of relationship between a client and a supplier. A client is dependent on the supplier for supplying products. If the supplier will not supply the products, client cannot use those products.
- anil kumar sahoo
here we need to change the person as well, because your assigning the salary value to long type, and your going to change it’s type to String…
- manjusha
here, we need to change the client class i.e. person also as we are going to change the salary type to String and here it’s type is long.
- manjusha
Some examples code perspective regarding to Association,Aggregation & Composition would be much more helpful . Please share some code snippets regarding this
- Sidharth Panda