Constructors in java

Constructors in java

Constructors is a Special member in java. while has same as class name.

It looks like a method but its not a method actually .Because methods has returns type but constructors has does not have return type.

It is generally used to initialized instance variables.

Each and every class in java has a default constructor provided by the compiler only when programmer does not provide the constructor.

There are two types of constructors in java :

\=================================

1.Default Constructors.

2.User-defined constructors.

inside the User-defined constructor there are two different types :

i)Parameterized constructor.

ii)Non-Parameterized constructor.