Java Class Constructors
A constructor is a special method that describes the initialization process of an object when the object is created from a class. It is always executed when the object is created.
[public/private/protected] ClassName(parameters) {
// Initialization statements
}
Access Control Modifiers
- Visible to the class only (
private). - Visible to the world (
public).
Constructor Overloading
A class can have multiple constructors.