Answers

Question and Answer:

  Home  Java Software Engineer

⟩ Tell us what are constructors in Java?

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

 194 views

More Questions for you: