{"id":77392,"date":"2020-03-26T13:39:53","date_gmt":"2020-03-26T08:09:53","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=77392"},"modified":"2020-03-26T13:39:53","modified_gmt":"2020-03-26T08:09:53","slug":"java-constructor","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/","title":{"rendered":"Java Constructor &#8211; An Exclusive Guide on Constructors"},"content":{"rendered":"<p>In this Java tutorial, we are going to discuss everything that you must know about a Constructor in Java. Constructor in Java is a block of code that creates an object. We can also call it an <strong>Object Builder<\/strong>.<\/p>\n<p>They are similar to methods in Java but they differ from methods in the fact that they do not have a return type like methods.<\/p>\n<p>In this article, we will learn what a constructor is, the need for constructors, its types, and the rules for writing constructors in Java. We will also cover some other topics like Constructor Overloading and Constructor Chaining.<\/p>\n<p>We will also see how the methods are different from the constructors in Java.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/java-constructor-vs-java-method.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77718\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/java-constructor-vs-java-method.jpg\" alt=\"\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<h3>Constructor in Java<\/h3>\n<p><em>\u201cA <strong>Constructor<\/strong> is a member function which has the same name as its class and is used to initialize the object of that class type with the legal initial value.\u201d<\/em><\/p>\n<p>A constructor is a member function of a class that is called for initializing objects when we create an object of that class. It is a special type of method that instantiates a newly created object and just after the memory allocation of this object takes place, the constructor is called.<\/p>\n<p>The name of the constructor is the same name as that of the class and its primary job is to initialize the object with a legal initial value for the class. It is not necessary for Java coders to write a constructor for a class.<\/p>\n<p><em><strong>Note:<\/strong> When we create an object of a class, at least one constructor is called. If we do not write any constructor in the class then the default constructor is called.<\/em><\/p>\n<h3>Need for Java Constructor<\/h3>\n<p>We can use the constructors when we want to assign values to the class variables at the time of object creation. To understand the importance of constructors, let\u2019s take an example. Suppose there is a Table.<\/p>\n<p>If we create a class named <strong>Apple<\/strong>, then it will have some class variables like shape, color, and taste. But, when we create an object of the class Apple, now <strong>Apple<\/strong> will reside in the computer\u2019s memory. Can we define an <strong>Apple<\/strong> with no value defined for its properties? We can definitely not do this.<\/p>\n<p>The constructors allow us to define the values while creating the objects. We can create a constructor either explicitly through programming and if we do not define it explicitly, the Java compiler itself defines the default constructor.<\/p>\n<h3>Rules for Writing Constructors in Java<\/h3>\n<p>Following are some rules for writing constructors in Java:<\/p>\n<ul>\n<li>The name of the constructor must be the same as the name of its class.<\/li>\n<li>A constructor must have no return type. It can not have not even void as its return type.<\/li>\n<li>We can use the access modifiers with a constructor to control its access so that other classes can call the constructor.<\/li>\n<li>We can not declare a constructor as final, abstract, abstract and synchronized.<\/li>\n<\/ul>\n<h3>The syntax for writing a Constructor<\/h3>\n<p>A constructor has the same name as the class and we can write a constructor as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public class MyClass\n{\n        \/\/This is the Constructor\n        MyClass()\n        {\n                \/\/Constructor body\n        }\n..\n}<\/pre>\n<p>Note that the constructor name matches the class name and it is without a return type.<\/p>\n<h3>How does constructor work in Java?<\/h3>\n<p>Let\u2019s take an example to understand the working of a constructor. Suppose we have a class named MyClass. When we initialize or create the object of MyClass it looks like this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">MyClass obj = new MyClass();<\/pre>\n<p>In the above line, the <strong>new<\/strong> keyword creates the object of class MyClass and invokes or calls the constructor to initialize this newly created object.<\/p>\n<h3>Types of Constructor in Java<\/h3>\n<p>There are two types of constructors in Java, which are:<\/p>\n<ul>\n<li>Default Constructor<\/li>\n<li>Parameterized Constructor<\/li>\n<\/ul>\n<p>Let\u2019s discuss each of them with examples:<\/p>\n<h4>1. Default Constructor<\/h4>\n<p>A Default Constructor is a constructor with no parameter. The Java compiler automatically creates a default constructor if we do not write any constructor in our program.<\/p>\n<p>This default constructor is not present in your source code or the java file as the compiler automatically puts it into the Java code during the compilation process and therefore we can\u2019t find it in our java file, rather it exists in the bytecode or .class file. The following figure shows this process:<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/default-constructor-in-java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77694\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/default-constructor-in-java.jpg\" alt=\"\" width=\"804\" height=\"322\" \/><\/a><\/p>\n<p>If we do not provide an user-defined constructor in a class, the compiler initializes member variables to its default values such as:<\/p>\n<ul>\n<li>numeric data types set to 0<\/li>\n<li>char data types set to a null character (\u2018\\0\u2019)<\/li>\n<li>reference variables set to null<\/li>\n<\/ul>\n<p><strong>Code to understand Default Constructors:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.constructors;\nclass TechVidvan\n{\n  int number;\n  String name;\n  TechVidvan()\n  {\n    System.out.println(\"Default Constructor called\");\n  }\n}\npublic class DefaultConstructor\n{\n  public static void main(String[] args)\n  {\n    TechVidvan object = new TechVidvan();\n    System.out.println(object.name);\n    System.out.println(object.number);\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Default Constructor called<br \/>\nnull<br \/>\n0<\/div>\n<p><strong>Note:<\/strong> If you implement any constructor then the Java compiler will no longer provide a default constructor.<\/p>\n<h4>2. Parameterized Constructor<\/h4>\n<p>A Parameterized constructor is a constructor with a specific number of parameters. We can use parameterized constructor mainly to initialize the members of the class with different values or objects.<\/p>\n<p><strong>Code to understand Parameterized Constructors:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.constructors;\nclass TechVidvan\n{\n  String name;\n  int id;\n\n  \/\/Creating a parameterized constructor\n  TechVidvan(String name, int id)\n  {\n    this.name = name;\n    this.id = id;\n  }\n}\npublic class ParamaterizedConstructor\n{\n  public static void main (String[] args)\n  {\n    TechVidvan object = new TechVidvan(\"Raj\", 16);\n    System.out.println(\"Name: \" + object.name );\n    System.out.println(\"id: \" + object.id);\n\n    TechVidvan object1 = new TechVidvan1(\"Shivani\", 24);\n    System.out.println(\"Name: \" + object1.name );\n    System.out.println(\"id: \" + object1.id);\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Name: Raj<br \/>\nid: 16<br \/>\nName: Shivani<br \/>\nid: 24<\/div>\n<h3>Constructor Chaining in Java<\/h3>\n<p>Constructor Chaining in Java is a process in which a constructor calls another constructor of the same class with the current\/present object. The concept of constructor chaining helps to pass the parameters through different constructors, but with the same object.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/constructor-chaining-in-java-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77697\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/constructor-chaining-in-java-1.jpg\" alt=\"\" width=\"552\" height=\"542\" \/><\/a><\/p>\n<h3>Constructor Overloading in Java- Multiple Constructors for a Java Class<\/h3>\n<p>Overloading generally means <em>\u201cto have multiple instances of the same thing\u201d.<\/em> Constructor Overloading in Java is a process of having more than one constructor with different parameters list.<\/p>\n<p>It allows the constructor to behave differently and perform a different task with respect to its parameters. Constructor overloading is the same as <em><strong><a href=\"https:\/\/techvidvan.com\/tutorials\/method-overloading-and-overriding\/\">method overloading in Java.<\/a><\/strong><\/em><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/constructor-overloading-in-java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77696\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/constructor-overloading-in-java.jpg\" alt=\"\" width=\"578\" height=\"368\" \/><\/a><\/p>\n<p><strong>Code to understand Constructor Overloading in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.constructors;\nclass TechVidvan\n{\n  TechVidvan(String name)\n  {\n    System.out.println(\"Constructor with one parameter: String: \");\n    System.out.println(\"Name: \" +name);\n  }\n  TechVidvan(String name, int age)\n  {\n    System.out.println(\"Constructor with two parameters: String and Integer: \");\n    System.out.println(\"Name: \" +name);\n    System.out.println(\"Age: \" +age);\n  }\n  TechVidvan(long id)\n  {\n    System.out.println(\"Constructor with one parameter: Long: \");\n    System.out.println(\"id: \" +id);\n  }\n}\npublic class ConstructorOverloading\n{\n  public static void main(String[] args)\n  {\n    TechVidvan ObjectName = new TechVidvan(\"Sameer\");\n    TechVidvan ObjectName1 = new TechVidvan(\"Neeraj\", 25);\n    TechVidvan ObjectName2 = new TechVidvan(235784567);\n  }\n\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Constructor with one parameter: String:<br \/>\nName: Sameer<br \/>\nConstructor with two parameters: String and Integer:<br \/>\nName: Neeraj<br \/>\nAge: 25<br \/>\nConstructor with one parameter: Long:<br \/>\nid: 235784567<\/div>\n<h3>Constructor and Inheritance: Super() Keyword<\/h3>\n<p>The compiler implicitly invokes the constructor of the parent class whenever we invoke or call a constructor of its child class. To do this, the Java compiler inserts a super() keyword at the beginning of the child class constructor.<\/p>\n<p>In the below code, we called the child class constructor but firstly the constructor of parent class runs and then the constructor of child class id executed because the compiler puts the super keyword at the beginning of child class constructor,<\/p>\n<p>therefore, the control first moves to the parent class constructor and then to the child class constructor.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class Parent\n{\n       Parent()\n       {\n              System.out.println(\"Parent Class Constructor\");\n       }\n}\nclass Child extends Parent\n{\n       Child()\n       {\n              System.out.println(\"Child Class Constructor\");\n       }\n       public static void main(String args[])\n       {\n              new Child();\n       }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Parent Class Constructor<br \/>\nChild Class Constructor<\/div>\n<h3>Difference Between Constructor and Method in Java<\/h3>\n<p>The following points explain the difference between constructor and method in Java.<\/p>\n<ul>\n<li>A constructor is a block of code that instantiates a newly created object, while a method is a set of statements that always return value depending upon its execution.<\/li>\n<li>The constructor\u2019s name should be the same as the class name. On the other hand, the name of the method should not be the same as the class name.<\/li>\n<li>Constructors are called implicitly, while we call the methods explicitly.<\/li>\n<li>A constructor should not have any return type, not even void, but methods must have a return type.<\/li>\n<li>The compiler automatically creates the constructor if there is no constructor in the class. But, in the case of the method, there is no default method provided by the compiler.<\/li>\n<li>We can override a method but we can\u2019t override a constructor.<\/li>\n<\/ul>\n<h4>Important Points<\/h4>\n<ul>\n<li>Constructors are called implicitly when we instantiate objects with the new operator.<\/li>\n<li>The two rules for creating a constructor are:<\/li>\n<\/ul>\n<ol>\n<li>A name of a Java constructor name must exactly match with the class name.<\/li>\n<li>A Java constructor must not have a return type.<\/li>\n<\/ol>\n<ul>\n<li>If there is no constructor in a class then the Java compiler automatically creates a default constructor during the compilation.<\/li>\n<li>We can\u2019t declare constructors as abstract, synchronized, static or final.<\/li>\n<li>We can overload a constructor but we can\u2019t override a constructor.<\/li>\n<li>Every class has a constructor whether it is a concrete class or an abstract class.<\/li>\n<li>A constructor can use any access specifier.<\/li>\n<li><em><strong>Interfaces<\/strong><\/em> can not have constructors.<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>Constructors are useful to instantiate an object. They are similar to methods but have some differences which we covered in this article. That was all about Java Constructor. Coming to the end of this article, we learned how to create a constructor along with its working.<\/p>\n<p>We discussed the importance of constructors. Also, we covered the two types of constructors in Java with the examples and how we can overload a constructor in Java.<\/p>\n<p>We also studied briefly about the Constructor Chaining in Java. This article will surely help you to sharpen your concepts in Java Constructors.<\/p>\n<p>Thank you for reading our article. Do share your feedback through the comment section below.<\/p>\n<p>Happy Learning \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Java tutorial, we are going to discuss everything that you must know about a Constructor in Java. Constructor in Java is a block of code that creates an object. We can also&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":77718,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064],"class_list":["post-77392","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-constructor-and-inheritance-in-java","tag-constructor-chaining-in-java","tag-constructor-in-java","tag-default-constructor-in-java","tag-how-java-constructor-works","tag-java-constructor","tag-java-constructor-need","tag-java-constructor-types","tag-java-constructor-writing-rules","tag-parameterized-constructor-in-java","tag-types-of-constructor-in-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Constructor - An Exclusive Guide on Constructors - TechVidvan<\/title>\n<meta name=\"description\" content=\"Make yourself aware with the concept of Java Constructor along with its working, importance, and the 2 types of Constructor in Java with some examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/java-constructor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Constructor - An Exclusive Guide on Constructors - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Make yourself aware with the concept of Java Constructor along with its working, importance, and the 2 types of Constructor in Java with some examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/java-constructor\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-26T08:09:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/java-constructor-vs-java-method.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Constructor - An Exclusive Guide on Constructors - TechVidvan","description":"Make yourself aware with the concept of Java Constructor along with its working, importance, and the 2 types of Constructor in Java with some examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/","og_locale":"en_US","og_type":"article","og_title":"Java Constructor - An Exclusive Guide on Constructors - TechVidvan","og_description":"Make yourself aware with the concept of Java Constructor along with its working, importance, and the 2 types of Constructor in Java with some examples.","og_url":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-03-26T08:09:53+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/java-constructor-vs-java-method.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Java Constructor &#8211; An Exclusive Guide on Constructors","datePublished":"2020-03-26T08:09:53+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/"},"wordCount":1450,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/java-constructor-vs-java-method.jpg","keywords":["Constructor and Inheritance in Java","Constructor Chaining in Java","Constructor in Java","Default Constructor in Java","How Java Constructor Works?","java constructor","Java Constructor Need","Java Constructor Types","Java Constructor Writing Rules","Parameterized Constructor in Java","Types of Constructor in Java"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/java-constructor\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/","url":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/","name":"Java Constructor - An Exclusive Guide on Constructors - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/java-constructor-vs-java-method.jpg","datePublished":"2020-03-26T08:09:53+00:00","description":"Make yourself aware with the concept of Java Constructor along with its working, importance, and the 2 types of Constructor in Java with some examples.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/java-constructor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/java-constructor-vs-java-method.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/java-constructor-vs-java-method.jpg","width":802,"height":420,"caption":"java constructor vs java method"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/java-constructor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Java Constructor &#8211; An Exclusive Guide on Constructors"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=77392"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77392\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/77718"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=77392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=77392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=77392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}