Aggregation in Java
Aggregation is HAS-A: one object uses another. Student has an Address. Model it with a field: Address address; inside Student. Not extends.
Address can still exist if Student goes away — weaker ownership. Inheritance is IS-A. Aggregation is HAS-A. Composition is a stronger “part-of” idea (engine inside car).
Using extends when the real relationship is HAS-A is the usual design mistake. Interview line: Student HAS-A Address — field reference, not extends.
Let's take this on the board with one tiny Main class — no extra files. Aggregation in Java — output: Asha - Pune. Address can exist without Student — that is aggregation (HAS-A), not IS-A. Start from main, go line by line, and stop at each print. That output is the proof for Aggregation.
Say HAS-A with Student/Address. Contrast with extends.