# Composition

Building a class from other objects that handle parts of its work.

## What is **Composition** in Java?

**Composition** — Building a class from other objects that handle parts of its work.

```java
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](https://www.ask-codey.com/glossary/subjects/java/journeyman)

Updated: September 27, 2026

## In other subjects

- [Composition in C#](https://www.ask-codey.com/glossary/composition-c-sharp)
- [Composition in OOP](https://www.ask-codey.com/glossary/composition-oop)

Source: https://www.ask-codey.com/glossary/composition
