Aggregation is a type of association in which the relationship between two objects is a part or whole. This type of relationship is loosely coupled and an object can survive alone also. You can say they have the “has-a” relationship. The aggregation is depicted as a empty diamond in UML diagram. For example, a student can have professor object but still the student can work independently. In other terms we can say student object has a professor object. But student object can be independently accessed. If you delete the professor object, student object can still survive.
Composition on the other hand is a type of association in which the relationship between two objects is tightly coupled. One object depends on the other and cannot survive alone. The objects have a strong “has-a” relationship with the other object. You can say one object is the part of the other object. The composition is depicted as fill diamond in UML diagram. For example, a house object is composed of room object. If you delete the house object, room object will have no existence. So, the room object requires a house object.