Java Constructors (manohar academy)

preview_player
Показать описание
Welcome to manohar academy.

In this lesson we are going to learn about java constructors.

Constructors are used to construct objects.
They can also be used to construct the object with intial values received from the program.

If and only if there is no user defined constructor in the class then compiler provides default constructor.
A class can have more than one constructor and a constructor can call other constructors.

Constructor name is always same as class name.
Constructors can not have return type as they always return reference to newly created object.
And constructor has to be invoked always with the new keyword.

The other topics on constructor will be covered in a different lesson.

Рекомендации по теме