Constructors in java

Posted By on September 9, 2014


Download PDF
Characteristics of JAVA
Garbage collection

A constructor initializes an object immediately upon creation.

It has the same name as the class  in which it resides and is  syntactically similar to a method.

Once defined, the constructor is automatically called immediately after the object is created, before the new operator completes.

Constructors look a little strange because they have  no return type, not even void.

This is because the implicit return type of a class’ constructor is the class type itself.

It is the constructor’s job to initialize the internal state of an object so that the code creating an instance will have a fully initialized, usable object immediately.

Characteristics of JAVA
Garbage collection

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com