{"id":37,"date":"2019-01-15T02:22:35","date_gmt":"2019-01-15T02:22:35","guid":{"rendered":"https:\/\/kindsonthegenius.com\/java\/?p=37"},"modified":"2019-03-02T04:35:15","modified_gmt":"2019-03-02T04:35:15","slug":"06-java-constructors","status":"publish","type":"post","link":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/","title":{"rendered":"Java &#8211; Constructors"},"content":{"rendered":"\n<ol class=\"wp-block-list\"><li><a href=\"#t1\">Introduction<\/a><\/li><li><a href=\"#t2\">Constructor with no Arguments<\/a><\/li><li><a href=\"#t3\">Parameterized  Constructors<\/a><\/li><li><a href=\"#t4\">Creating new Objects<\/a><\/li><\/ol>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"t1\">1. Introduction<\/h4>\n\n\n\n<p>Constructors in Java are  what we use to create new objects. Furthermore, you use a constructor on initialize new objects.  Constructors have the same name as the class and not return type.<\/p>\n\n\n\n<p>Generally,  you assign initial values to instance variables using a constructor. But you can also perform some initial tasks required when a new object is created.<\/p>\n\n\n\n<p>The code below give an example of a constructor.<\/p>\n\n\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #008800; font-weight: bold\">class<\/span> <span style=\"color: #BB0066; font-weight: bold\">Vehicle<\/span> <span style=\"color: #333333\">{<\/span>\n\t<span style=\"color: #008800; font-weight: bold\">public<\/span> String make<span style=\"color: #333333\">;<\/span>\n\t\n\t<span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #0066BB; font-weight: bold\">Vehicle<\/span><span style=\"color: #333333\">(<\/span>String make<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">{<\/span> <span style=\"color: #888888\">\/\/constructor with one parameter<\/span>\n\t\t<span style=\"color: #008800; font-weight: bold\">this<\/span><span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">make<\/span> <span style=\"color: #333333\">=<\/span> make<span style=\"color: #333333\">;<\/span>\n\t<span style=\"color: #333333\">}<\/span>\n<span style=\"color: #333333\">}<\/span>\n<\/pre>\n<\/div>\n\n\n<p>We have two types of constructors in Java.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Constructor with no arguments<\/li><li>Parameterized constructor<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong id=\"t2\">2. Constructors with no arguments<\/strong><\/h4>\n\n\n\n<p>These constructors require not arguments. In this way you can create an object even if you don&#8217;t have the attributes. Take for example, the code below.<\/p>\n\n\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #008800; font-weight: bold\">class<\/span> <span style=\"color: #BB0066; font-weight: bold\">Circle<\/span> <span style=\"color: #333333\">{<\/span>\n\t<span style=\"color: #333399; font-weight: bold\">int<\/span> radius<span style=\"color: #333333\">;<\/span>\n\t\n\t<span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #0066BB; font-weight: bold\">Circle<\/span> <span style=\"color: #333333\">()<\/span> <span style=\"color: #333333\">{<\/span> <span style=\"color: #888888\">\/\/Constructor with no parameter<\/span>\n\t\tradius <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">50<\/span><span style=\"color: #333333\">;<\/span>\n\t<span style=\"color: #333333\">}<\/span>\n<span style=\"color: #333333\">}<\/span>\n<\/pre>\n<\/div>\n\n\n<p>The constructor for circle has no parameters. However, when a new circle is created, it automatically has a radius of 50. Therefore if you run the code below, you will have an output of 50.<\/p>\n\n\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #008800; font-weight: bold\">class<\/span> <span style=\"color: #BB0066; font-weight: bold\">Tester<\/span> <span style=\"color: #333333\">{<\/span>\n\n\t<span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #008800; font-weight: bold\">static<\/span> <span style=\"color: #333399; font-weight: bold\">void<\/span> <span style=\"color: #0066BB; font-weight: bold\">main<\/span><span style=\"color: #333333\">(<\/span>String<span style=\"color: #333333\">[]<\/span> args<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">{<\/span>\n\t\tCircle circle <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> Circle<span style=\"color: #333333\">();<\/span>\n\t\t\n\t\tSystem<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">out<\/span><span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">println<\/span><span style=\"color: #333333\">(<\/span>circle<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">radius<\/span><span style=\"color: #333333\">);<\/span>\n\t<span style=\"color: #333333\">}<\/span>\n<span style=\"color: #333333\">}<\/span>\n<\/pre>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong id=\"t3\">3. Parameterized Constructors<\/strong><\/h4>\n\n\n\n<p>Sometimes, you will need a constructor that accepts one or more parameters. You specify the parameter inside braces after the constructor name. An example is given below<\/p>\n\n\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #008800; font-weight: bold\">class<\/span> <span style=\"color: #BB0066; font-weight: bold\">Circle<\/span> <span style=\"color: #333333\">{<\/span>\n\t<span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #333399; font-weight: bold\">int<\/span> radius<span style=\"color: #333333\">;<\/span>\n\t\n\t<span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #0066BB; font-weight: bold\">Circle<\/span> <span style=\"color: #333333\">(<\/span><span style=\"color: #333399; font-weight: bold\">int<\/span> radius<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">{<\/span> <span style=\"color: #888888\">\/\/Parameterized constructor<\/span>\n\t\t<span style=\"color: #008800; font-weight: bold\">this<\/span><span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">radius<\/span> <span style=\"color: #333333\">=<\/span> radius<span style=\"color: #333333\">;<\/span>\n\t<span style=\"color: #333333\">}<\/span>\n<span style=\"color: #333333\">}<\/span>\n<\/pre>\n<\/div>\n\n\n<p>In the same way, you can run create a circle using the code below. <\/p>\n\n\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #008800; font-weight: bold\">class<\/span> <span style=\"color: #BB0066; font-weight: bold\">Tester<\/span> <span style=\"color: #333333\">{<\/span>\n\n\t<span style=\"color: #008800; font-weight: bold\">public<\/span> <span style=\"color: #008800; font-weight: bold\">static<\/span> <span style=\"color: #333399; font-weight: bold\">void<\/span> <span style=\"color: #0066BB; font-weight: bold\">main<\/span><span style=\"color: #333333\">(<\/span>String<span style=\"color: #333333\">[]<\/span> args<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">{<\/span>\n\t\tCircle circle <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> Circle<span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">50<\/span><span style=\"color: #333333\">);<\/span>\n\t\t\n\t\tSystem<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">out<\/span><span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">println<\/span><span style=\"color: #333333\">(<\/span>circle<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">radius<\/span><span style=\"color: #333333\">);<\/span>\n\t<span style=\"color: #333333\">}<\/span>\n<span style=\"color: #333333\">}<\/span>\n<\/pre>\n<\/div>\n\n\n<p>Running the above code would also produce similar result to the previous one. 50 is printed out. But notice that in this constructor, you pass 50 as a parameter.<\/p>\n\n\n\n<p>Finally bear in mind, that two or even more constructors can be in the same class.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong id=\"t4\">4. Creating New Objects<\/strong><\/h4>\n\n\n\n<p>Just as you know, objects are create from classes. You use the new keyword to create new objects from classes. <\/p>\n\n\n\n<p>Note the three steps involved in creating new objects<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Declaration<\/strong>: Here, you specify a variable name as an object type<\/li><li><strong>Instantiation<\/strong>: You use the new keyword<\/li><li><strong>Initialization<\/strong>: Assign initial values<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Constructor with no Arguments Parameterized Constructors Creating new Objects 1. Introduction Constructors in Java are what we use to create new objects. Furthermore, you &hellip; <\/p>\n","protected":false},"author":395,"featured_media":38,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java - Constructors - Java Tutorials<\/title>\n<meta name=\"description\" content=\"You will learn about constructors in Java. You will learn about default constructor, parameterized constructor and constructors without parameter\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java - Constructors - Java Tutorials\" \/>\n<meta property=\"og:description\" content=\"You will learn about constructors in Java. You will learn about default constructor, parameterized constructor and constructors without parameter\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/\" \/>\n<meta property=\"og:site_name\" content=\"Java Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-15T02:22:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-02T04:35:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Constructors-in-Java.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"950\" \/>\n\t<meta property=\"og:image:height\" content=\"518\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"headline\":\"Java &#8211; Constructors\",\"datePublished\":\"2019-01-15T02:22:35+00:00\",\"dateModified\":\"2019-03-02T04:35:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/\"},\"wordCount\":298,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Constructors-in-Java.jpg\",\"articleSection\":[\"Java Tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/\",\"name\":\"Java - Constructors - Java Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Constructors-in-Java.jpg\",\"datePublished\":\"2019-01-15T02:22:35+00:00\",\"dateModified\":\"2019-03-02T04:35:15+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"description\":\"You will learn about constructors in Java. You will learn about default constructor, parameterized constructor and constructors without parameter\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Constructors-in-Java.jpg\",\"contentUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/wp-content\\\/uploads\\\/sites\\\/9\\\/2019\\\/01\\\/Constructors-in-Java.jpg\",\"width\":950,\"height\":518},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/06-java-constructors\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java &#8211; Constructors\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#website\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/\",\"name\":\"Java Tutorials\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/java\\\/author\\\/kindsonthegenius-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java - Constructors - Java Tutorials","description":"You will learn about constructors in Java. You will learn about default constructor, parameterized constructor and constructors without parameter","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:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/","og_locale":"en_US","og_type":"article","og_title":"Java - Constructors - Java Tutorials","og_description":"You will learn about constructors in Java. You will learn about default constructor, parameterized constructor and constructors without parameter","og_url":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/","og_site_name":"Java Tutorials","article_published_time":"2019-01-15T02:22:35+00:00","article_modified_time":"2019-03-02T04:35:15+00:00","og_image":[{"width":950,"height":518,"url":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Constructors-in-Java.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#article","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/www.kindsonthegenius.com\/java\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"headline":"Java &#8211; Constructors","datePublished":"2019-01-15T02:22:35+00:00","dateModified":"2019-03-02T04:35:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/"},"wordCount":298,"commentCount":0,"image":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Constructors-in-Java.jpg","articleSection":["Java Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/","url":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/","name":"Java - Constructors - Java Tutorials","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#primaryimage"},"image":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Constructors-in-Java.jpg","datePublished":"2019-01-15T02:22:35+00:00","dateModified":"2019-03-02T04:35:15+00:00","author":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"description":"You will learn about constructors in Java. You will learn about default constructor, parameterized constructor and constructors without parameter","breadcrumb":{"@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#primaryimage","url":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Constructors-in-Java.jpg","contentUrl":"https:\/\/www.kindsonthegenius.com\/java\/wp-content\/uploads\/sites\/9\/2019\/01\/Constructors-in-Java.jpg","width":950,"height":518},{"@type":"BreadcrumbList","@id":"https:\/\/www.kindsonthegenius.com\/java\/06-java-constructors\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kindsonthegenius.com\/java\/"},{"@type":"ListItem","position":2,"name":"Java &#8211; Constructors"}]},{"@type":"WebSite","@id":"https:\/\/www.kindsonthegenius.com\/java\/#website","url":"https:\/\/www.kindsonthegenius.com\/java\/","name":"Java Tutorials","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kindsonthegenius.com\/java\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.kindsonthegenius.com\/java\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/www.kindsonthegenius.com\/java\/author\/kindsonthegenius-2\/"}]}},"_links":{"self":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/users\/395"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":1,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":39,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/posts\/37\/revisions\/39"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/media\/38"}],"wp:attachment":[{"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/java\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}