DEV Community

Sathish K
Sathish K

Posted on

Constructor

What is the use of constructor and how to create constructor?
A constructor use is to initialize a new object of the class when it is created, ensuring it attributes have a valid state, often by setting the default or user defined values.To be create a same name of a class and no return type. It is a automatically called when you be new keyword to instantiate the object.

What is constructor overloading ?
A constructor overloading is the techique in Java is feature is allowed when a class can multiple constructor with same class name with different parameters is called as constructor overloading.

Top comments (0)