{"id":689,"date":"2022-10-05T23:17:44","date_gmt":"2022-10-05T15:17:44","guid":{"rendered":"https:\/\/qaqaq.top\/?p=689"},"modified":"2022-11-27T12:39:57","modified_gmt":"2022-11-27T04:39:57","slug":"%e9%9d%a2%e5%90%91%e5%af%b9%e8%b1%a1%e4%b8%ad-%e7%bb%a7%e6%89%bf%e6%80%a7%e7%bb%83%e4%b9%a02%ef%bc%9a%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/qaqaq.top\/?p=689","title":{"rendered":"\u9762\u5411\u5bf9\u8c61(\u4e2d)-\u7ee7\u627f\u6027\u7ec3\u4e602\uff1a\u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P268;\r\n\r\npublic class Circle {\r\n\r\n\tprivate double radius;\/\/ \u534a\u5f84\r\n\r\n\tpublic Circle() {\r\n\t\tradius = 1.0;\r\n\t}\r\n\r\n\tpublic double getRadius() {\r\n\t\treturn radius;\r\n\t}\r\n\r\n\tpublic void setRadius(double radius) {\r\n\t\tthis.radius = radius;\r\n\t}\r\n\r\n\t\/\/\u8fd4\u56de\u5706\u7684\u9762\u79ef\r\n\tpublic double findArea() {\r\n\t\treturn Math.PI * radius * radius;\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P268;\r\n\r\npublic class Cylinder extends Circle {\r\n\r\n\tprivate double length;\/\/ \u9ad8\r\n\r\n\tpublic Cylinder() {\r\n\t\tlength = 1.0;\r\n\t}\r\n\r\n\tpublic double getLength() {\r\n\t\treturn length;\r\n\t}\r\n\r\n\tpublic void setLength(double length) {\r\n\t\tthis.length = length;\r\n\t}\r\n\r\n\t\/\/\u8fd4\u56de\u5706\u67f1\u7684\u4f53\u79ef\r\n\tpublic double findVolume() {\r\n\/\/\t\treturn Math.PI * getRadius() * getRadius() * getLength();\r\n\t\treturn findArea() * getLength();\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P268;\r\n\r\npublic class CylinderTest {\r\n\r\n\tpublic static void main(String&#91;] args) {\r\n\t\t\r\n\t\tCylinder cy = new Cylinder();\r\n\t\t\r\n\t\tcy.setRadius(2.1);\r\n\t\tcy.setLength(3.4);\r\n\t\tdouble volume = cy.findVolume();\r\n\t\tSystem.out.println(\"\u5706\u67f1\u7684\u4f53\u79ef\u4e3a\uff1a\" + volume);\r\n\t\t\r\n\t\tdouble area = cy.findArea();\r\n\t\tSystem.out.println(\"\u5e95\u9762\u5706\u7684\u9762\u79ef\uff1a\" + area);\r\n\t}\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[46],"class_list":["post-689","post","type-post","status-publish","format-standard","hentry","category-java-code","tag-java"],"_links":{"self":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/689"}],"collection":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=689"}],"version-history":[{"count":1,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/689\/revisions"}],"predecessor-version":[{"id":690,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/689\/revisions\/690"}],"wp:attachment":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}