Tell us what are constructors in Java?

Submitted by: Muhammad
In Java, constructor refers to a block of code which is used to initialize an object. It must have the same name as that of the class. Also, it has no return type and it is automatically called when an object is created.

There are two types of constructors:

☛ Default constructor
☛ Parameterized constructor
Submitted by: Muhammad

Read Online Java Software Engineer Job Interview Questions And Answers