Question d’entretien chez Tech Mahindra

What is the necessity of having a constructor in Java code?