---
title: "What are constructors in Java?"  
description: "What are constructors in Java?"  
author: "Hemant Patel"  
published: 2017-12-18  
updated: 2020-09-19  
canonical: https://www.mindstick.com/interview/23341/what-are-constructors-in-java  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# What are constructors in Java?

In Java, constructor refers to a block of code similar to a method that’s called when an instance of an object is created. A constructor in Java must have the same name as that of the class. And it’s called automatically when a new instance of an object is created. Constructors are not considered as members of a class.

## Answers

### Answer by Hemant Patel

In Java, constructor refers to a block of code similar to a method that’s called when an instance of an object is created. A constructor in Java must have the same name as that of the class. And it’s called automatically when a new instance of an object is created. Constructors are not considered as members of a class.


---

Original Source: https://www.mindstick.com/interview/23341/what-are-constructors-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
