Aggregation

A relationship where one object uses another object that can exist independently.

What is Aggregation in Java?

Aggregation — A relationship where one object uses another object that can exist independently.

class Engine {
    String start() {
        return "Started";
    }
}

class Car {
    private final Engine engine = new Engine();

    String drive() {
        return engine.start();
    }
}

Level: Journeyman · More Java terms at this level

Updated

In other subjects