Basic concept and Principles

UML Notation:
Class Diagram notations, relations like Generalization, association, aggregation, composition.

Basic principles SOLID
SOLID is Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion.

Aggregation= Residing address is loosely coupled hence child is independent from parent can vary at any time. In spring framework the dependency injection is same as aggregation only.

Composition= tightly coupled with parent, lifetime is same for both parent like student class and child permanent address member

 class Address {
	 private final String place;    
	 Address(String str){
	  place = str;	 
	public String getPlace() {
		return place;
class Student {
	private final Address permanentAdr; 
	private Address residingAdr; 
	Student(String str){
		this.permanentAdr = new Address(str); 
	public void setResidingAdr(Address residingAdr) {
		this.residingAdr = residingAdr;
	public String getPermanentAdr() {
		return permanentAdr.getPlace();
	public String getResidingAdr() {
		return residingAdr.getPlace();  
public class AggComposition {	  
	public static void main(String[] args) {
		  Student   student = new Student("India");
		  Address  residingAdr1 = new Address("India");
		  System.out.println(student.getPermanentAdr()+" "+student.getResidingAdr());
		  Address  residingAdr2 = new Address("USA");
		  System.out.println(student.getPermanentAdr()+ " "+student.getResidingAdr());