{"id":50575,"date":"2023-08-24T20:33:13","date_gmt":"2023-08-24T12:33:13","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=50575"},"modified":"2023-08-24T20:33:16","modified_gmt":"2023-08-24T12:33:16","slug":"java%e4%b8%ad%e7%9a%84object%e7%b1%bb%ef%bc%8c%e6%8a%bd%e8%b1%a1%e7%b1%bb%ef%bc%8c%e6%8e%a5%e5%8f%a3%e4%bb%a5%e5%8f%8a%e5%92%8c%e7%bb%a7%e6%89%bf%e7%9a%84%e5%8c%ba%e5%88%ab%e6%98%af%e4%bb%80%e4%b9%88","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/50575.html","title":{"rendered":"java\u4e2d\u7684Object\u7c7b\uff0c\u62bd\u8c61\u7c7b\uff0c\u63a5\u53e3\u4ee5\u53ca\u548c\u7ee7\u627f\u7684\u533a\u522b\u662f\u4ec0\u4e48"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\">\n<p>\u5728Java\u7f16\u7a0b\u4e2d\uff0cObject\u7c7b\u3001\u62bd\u8c61\u7c7b\uff08Abstract Class\uff09\u3001\u63a5\u53e3\uff08Interface\uff09\u4ee5\u53ca\u7ee7\u627f\uff08Inheritance\uff09\u6709\u5404\u81ea\u4e0d\u540c\u7684\u7279\u70b9\u548c\u7528\u9014\u3002<strong>1\u3001\u901a\u7528\u6027\u4e0e\u7279\u6b8a\u6027<\/strong>\uff1b<strong>2\u3001\u5b9e\u4f8b\u5316\u4e0e\u62bd\u8c61\u6027<\/strong>\uff1b<strong>3\u3001\u591a\u91cd\u7ee7\u627f\u4e0e\u5355\u4e00\u7ee7\u627f<\/strong>\u3002\u5728\u901a\u7528\u6027\u4e0e\u7279\u6b8a\u6027\u65b9\u9762\uff0c\u63a5\u53e3\u548c\u62bd\u8c61\u7c7b\u90fd\u5141\u8bb8\u4f60\u5b9a\u4e49\u65b9\u6cd5\u7b7e\u540d\uff0c\u4f46\u62bd\u8c61\u7c7b\u8fd8\u5141\u8bb8\u4f60\u63d0\u4f9b\u90e8\u5206\u5b9e\u73b0\u3002<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"680\" height=\"421\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/08\/pingcode\u6b63\u6587-36-2.jpg?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\" class=\"wp-image-50577\" srcset=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/08\/pingcode\u6b63\u6587-36-2.jpg 680w, https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/08\/pingcode\u6b63\u6587-36-2-300x186.jpg 300w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u901a\u7528\u6027\u4e0e\u7279\u6b8a\u6027<\/strong><\/h2>\n\n\n\n<ol>\n<li><strong>Object\u7c7b<\/strong>: Object\u662fJava\u4e2d\u6240\u6709\u7c7b\u7684\u7956\u5148\u3002\u5b83\u5b9a\u4e49\u4e86\u4e00\u4e9b\u6240\u6709Java\u5bf9\u8c61\u90fd\u6709\u7684\u57fa\u672c\u65b9\u6cd5\uff0c\u5982<code>equals()<\/code>, <code>hashCode()<\/code>, <code>toString()<\/code>\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u62bd\u8c61\u7c7b\uff08Abstract Class\uff09<\/strong>: \u62bd\u8c61\u7c7b\u662f\u7528\u4e8e\u5b9a\u4e49\u4e0d\u5b8c\u5168\u5b9e\u73b0\u7684\u7c7b\uff0c\u5176\u4e2d\u53ef\u4ee5\u5305\u542b\u62bd\u8c61\u65b9\u6cd5\u548c\u5177\u4f53\u5b9e\u73b0\u7684\u65b9\u6cd5\u3002<\/li>\n\n\n\n<li><strong>\u63a5\u53e3\uff08Interface\uff09<\/strong>: \u63a5\u53e3\u662f\u4e00\u4e2a\u5b9a\u4e49\u4e86\u884c\u4e3a\u89c4\u8303\u4f46\u672a\u8fdb\u884c\u5b9e\u73b0\u7684\u62bd\u8c61\u7c7b\u578b\u3002<\/li>\n\n\n\n<li><strong>\u7ee7\u627f\uff08Inheritance\uff09<\/strong>: \u7ee7\u627f\u7528\u4e8e\u5728\u73b0\u6709\u7c7b\u7684\u57fa\u7840\u4e0a\u8fdb\u884c\u6269\u5c55\u3002\u65b0\u7c7b\u7ee7\u627f\u4e86\u57fa\u7c7b\u7684\u5c5e\u6027\u548c\u65b9\u6cd5\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u5b9e\u4f8b\u5316\u4e0e\u62bd\u8c61\u6027<\/strong><\/h2>\n\n\n\n<ol>\n<li><strong>Object\u7c7b\u548c\u666e\u901a\u7684\u7ee7\u627f\u7c7b<\/strong>: \u53ef\u4ee5\u88ab\u5b9e\u4f8b\u5316\u3002<\/li>\n\n\n\n<li><strong>\u62bd\u8c61\u7c7b\u548c\u63a5\u53e3<\/strong>: \u4e0d\u80fd\u88ab\u5b9e\u4f8b\u5316\uff0c\u5fc5\u987b\u901a\u8fc7\u5b50\u7c7b\u6216\u5b9e\u73b0\u7c7b\u6765\u4f7f\u7528\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u591a\u91cd\u7ee7\u627f\u4e0e\u5355\u4e00\u7ee7\u627f<\/strong><\/h2>\n\n\n\n<ol>\n<li><strong>\u5355\u4e00\u7ee7\u627f<\/strong>: Java\u4e0d\u652f\u6301\u591a\u91cd\u7ee7\u627f\uff0c\u5373\u4e00\u4e2a\u7c7b\u4e0d\u80fd\u540c\u65f6\u7ee7\u627f\u591a\u4e2a\u7c7b\u3002<\/li>\n\n\n\n<li><strong>\u591a\u91cd\u7ee7\u627f\u901a\u8fc7\u63a5\u53e3\u5b9e\u73b0<\/strong>: \u4e00\u4e2a\u7c7b\u53ef\u4ee5\u5b9e\u73b0\u591a\u4e2a\u63a5\u53e3\uff0c\u4ece\u800c\u8fbe\u5230\u591a\u91cd\u7ee7\u627f\u7684\u6548\u679c\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5e38\u89c1\u95ee\u7b54<\/strong><\/h2>\n\n\n\n<ul>\n<li><strong>Q1: Object\u7c7b\u4e2d\u5b9a\u4e49\u4e86\u54ea\u4e9b\u65b9\u6cd5\uff1f<\/strong><\/li>\n\n\n\n<li>Object\u7c7b\u4e2d\u5b9a\u4e49\u4e86<code>equals()<\/code>, <code>hashCode()<\/code>, <code>toString()<\/code>\u7b49\u57fa\u672c\u65b9\u6cd5\u3002<\/li>\n\n\n\n<li><strong>Q2: \u62bd\u8c61\u7c7b\u548c\u63a5\u53e3\u6709\u4f55\u5171\u540c\u4e4b\u5904\uff1f<\/strong><\/li>\n\n\n\n<li>\u4e24\u8005\u90fd\u4e0d\u80fd\u88ab\u5b9e\u4f8b\u5316\uff0c\u4e14\u53ef\u4ee5\u5305\u542b\u672a\u5b9e\u73b0\u7684\u65b9\u6cd5\uff08\u62bd\u8c61\u65b9\u6cd5\uff09\u3002<\/li>\n\n\n\n<li><strong>Q3: \u5982\u4f55\u9009\u62e9\u4f7f\u7528\u62bd\u8c61\u7c7b\u8fd8\u662f\u63a5\u53e3\uff1f<\/strong><\/li>\n\n\n\n<li>\u5982\u679c\u4f60\u9700\u8981\u5b9a\u4e49\u5171\u4eab\u7684\u5b9e\u73b0\u4ee3\u7801\uff0c\u4f7f\u7528\u62bd\u8c61\u7c7b\uff1b\u5982\u679c\u9700\u8981\u5b9a\u4e49\u4e00\u7ec4\u884c\u4e3a\u89c4\u8303\u4f46\u4e0d\u9700\u8981\u5171\u4eab\u4ee3\u7801\uff0c\u4f7f\u7528\u63a5\u53e3\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u5728Java\u7f16\u7a0b\u4e2d\uff0cObject\u7c7b\u3001\u62bd\u8c61\u7c7b\uff08Abstract Class\uff09\u3001\u63a5\u53e3\uff08Interface\uff09\u4ee5\u53ca\u7ee7\u627f\uff08 [&hellip;]","protected":false},"author":6,"featured_media":50576,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[1967,1968,1736,1713,367],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/50575"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=50575"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/50575\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/50576"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=50575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=50575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=50575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}