Constructor

Special class code that initializes a new object.

What is Constructor in Java?

Constructor — Special class code that initializes a new object.

class Book {
    String title;

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

Level: Journeyman · More Java terms at this level

Updated

In other subjects