{"id":4405,"date":"2014-03-30T10:39:09","date_gmt":"2014-03-30T10:39:09","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/what-is-the-object-instantiated-from-an-interface-collection-of-common-programming-errors\/"},"modified":"2014-03-30T10:39:09","modified_gmt":"2014-03-30T10:39:09","slug":"what-is-the-object-instantiated-from-an-interface-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/what-is-the-object-instantiated-from-an-interface-collection-of-common-programming-errors\/","title":{"rendered":"What is the object instantiated from an Interface-Collection of common programming errors"},"content":{"rendered":"<p>As already stated in other answers, <code>Person<\/code> is an interface so can&#8217;t be instantiated. Therefore it is useful to include the arguments in the constructor of the implementing class since the latter&#8217;s setters will not be directly accessible from a <code>Person<\/code> reference<\/p>\n<pre><code>public Student(int id, String name) {\n    this.id = id;\n    this.name = name;\n}\n<\/code><\/pre>\n<p>so as to initialize<\/p>\n<pre><code>Person s = new Student(1, \"Jon Smith\");\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As already stated in other answers, Person is an interface so can&#8217;t be instantiated. Therefore it is useful to include the arguments in the constructor of the implementing class since the latter&#8217;s setters will not be directly accessible from a Person reference public Student(int id, String name) { this.id = id; this.name = name; } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4405","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4405"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4405\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}