What is a constructor in Java?

Solution:

A constructor is a block of code which is used in a Java environment to initialize an object. It carries the same name that you had given to the class. A Java constructor is automatically called when an object is created

0 answers