---
title: "Discussion on \"What is constructor\" | Hashnode"
description: "Discussion on \"What is constructor\". Constructor is a special type of method whose name is same as class name. And it is used to contract the object.\nConstructor does not contain any return type. If it contain return type then it must be treated as a method.\nThe main purpose of construc..."
url: "https://hashnode.com/posts/what-is-constructor/67521663faa18cf37c8b6be0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What is constructor](https://what-is-oops.hashnode.dev/what-is-constructor?utm_source=hashnode&utm_medium=feed)

Constructor is a special type of method whose name is same as class name. And it is used to contract the object. Constructor does not contain any return type. If it contain return type then it must be treated as a method. The main purpose of construc...

Dec 5, 2024 · 1 min read · what-is-oops.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#basic](https://hashnode.com/tag/basic)
-   [#learning](https://hashnode.com/tag/learning)

## Written by

[Mitali sahu](https://hashnode.com/@mitalisahu)

@mitalisahu

  
[View profile](https://hashnode.com/@mitalisahu)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
