# Constructor

Special class code that initializes a new object.

## What is **Constructor** in Java?

**Constructor** — Special class code that initializes a new object.

```java
class Book {
    String title;

    Book(String title) {
        this.title = title;
    }
}
```

Level: Journeyman · [More Java terms at this level](https://www.ask-codey.com/glossary/subjects/java/journeyman)

Updated: September 27, 2026

## In other subjects

- [Constructor in C#](https://www.ask-codey.com/glossary/constructor-c-sharp)
- [Constructor in JavaScript](https://www.ask-codey.com/glossary/constructor-javascript)
- [Constructor in OOP](https://www.ask-codey.com/glossary/constructor-oop)

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