{"id":232,"date":"2003-01-23T22:24:43","date_gmt":"2003-01-24T02:24:43","guid":{"rendered":"http:\/\/wordpress.cephas.net\/?p=232"},"modified":"2003-01-23T22:24:43","modified_gmt":"2003-01-24T02:24:43","slug":"use-of-the-class-object","status":"publish","type":"post","link":"https:\/\/cephas.net\/blog\/2003\/01\/23\/use-of-the-class-object\/","title":{"rendered":"Use of the Class object"},"content":{"rendered":"<p>On the subject of the use of the <a href=\"http:\/\/java.sun.com\/j2se\/1.4\/docs\/api\/java\/lang\/Class.html\">Class<\/a> object:<\/p>\n<p>&#8220;&#8230; Reassuringly, instanceof and <a href=\"http:\/\/java.sun.com\/j2se\/1.4\/docs\/api\/java\/lang\/Class.html#isInstance(java.lang.Object)\">isInstance<\/a>( ) produce exactly the same results, as do equals( ) and ==. But the tests themselves draw different conclusions. In keeping with the concept of type, instanceof says \u201care you this class, or a class derived from this class?\u201d On the other hand, if you compare the actual Class objects using ==, (or <a href=\"http:\/\/java.sun.com\/j2se\/1.4\/docs\/api\/java\/lang\/Object.html#getClass()\">getClass()<\/a>) there is no concern with inheritance\u2014it\u2019s either the exact type or it isn\u2019t.&#8221; [<a href=\"http:\/\/www.ezdefinition.com\/cgi-bin\/showsubject.cgi?sid=793\">ezdefinition<\/a>]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On the subject of the use of the Class object: &#8220;&#8230; Reassuringly, instanceof and isInstance( ) produce exactly the same results, as do equals( ) and ==. But the tests themselves draw different conclusions. In keeping with the concept of type, instanceof says \u201care you this class, or a class derived from this class?\u201d On &hellip; <a href=\"https:\/\/cephas.net\/blog\/2003\/01\/23\/use-of-the-class-object\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Use of the Class object<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/232"}],"collection":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":0,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"wp:attachment":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}