{"id":517,"date":"2019-02-16T09:49:13","date_gmt":"2019-02-16T01:49:13","guid":{"rendered":"http:\/\/www.eait.co\/?p=517"},"modified":"2019-04-05T12:32:22","modified_gmt":"2019-04-05T04:32:22","slug":"java-%e7%9a%84%e5%90%91%e4%b8%8a%e8%bd%ac%e5%9e%8b%e5%92%8c%e5%90%91%e4%b8%8b%e8%bd%ac%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/notes.coremix.net\/?p=517","title":{"rendered":"Java\u2014\u2014\u7684\u5411\u4e0a\u8f6c\u578b\u548c\u5411\u4e0b\u8f6c\u578b"},"content":{"rendered":"<p>\u5728\u8fd9\u91cc \u8981 \u7740\u91cd \u8bb2\u89e3 \u4e24\u4e2a \u6982\u5ff5\uff0c \u5e0c\u671b \u8bfb\u8005 \u4e88\u4ee5 \u91cd\u89c6\u3002 1. \u5411\u4e0a \u8f6c\u578b \u5728\u4e0a \u9762\u7684 \u8303\u4f8b TestJavaDemo1. Java \u4e2d\uff0c \u7236 \u7c7b \u5bf9\u8c61 \u901a\u8fc7 \u5b50\u7c7b \u5bf9\u8c61 \u53bb \u5b9e\u4f8b \u5316\uff0c \u5b9e\u9645\u4e0a \u5c31\u662f \u5bf9\u8c61 \u7684 \u5411\u4e0a \u8f6c\u578b\u3002 \u5411\u4e0a \u8f6c\u578b \u662f \u4e0d\u9700\u8981 \u8fdb\u884c \u5f3a\u5236 \u7c7b\u578b \u8f6c\u6362 \u7684\uff0c \u4f46\u662f \u5411\u4e0a \u8f6c\u578b \u4f1a \u4e22\u5931 \u7cbe\u5ea6\u3002 2. \u5411\u4e0b \u8f6c\u578b \u4e0e \u5411\u4e0a \u8f6c\u578b \u5bf9\u5e94 \u7684 \u4e00\u4e2a \u6982\u5ff5 \u5c31\u662f\u201c \u5411\u4e0b \u8f6c\u578b\u201d\uff0c \u6240\u8c13 \u5411\u4e0b \u8f6c\u578b\uff0c \u4e5f\u5c31\u662f\u8bf4 \u7236 \u7c7b \u7684 \u5bf9\u8c61 \u53ef\u4ee5 \u8f6c\u6362 \u4e3a \u5b50\u7c7b \u5bf9\u8c61\uff0c \u4f46\u662f \u9700\u8981 \u6ce8\u610f \u7684 \u662f\uff0c \u8fd9\u65f6 \u5219 \u5fc5\u987b \u8981 \u8fdb\u884c \u5f3a\u5236 \u7684 \u7c7b\u578b \u8f6c\u6362\u3002 \u8bfb\u8005 \u53ef\u80fd \u89c9\u5f97 \u4e0a\u9762 \u7684 \u4e24\u4e2a \u6982\u5ff5 \u6709\u4e9b \u96be\u4ee5 \u7406\u89e3\uff0c \u4e0b\u9762 \u4e3e\u4e2a \u4f8b\u5b50 \u6765 \u5e2e\u52a9 \u8bfb\u8005 \u7406\u89e3\u3002<\/p>\n<pre>\/**\r\n * Created by xabcd on 2019\/2\/16.\r\n *\/\r\npublic class Java_shilihua {\r\n    public void fun1() {\r\n        System.out.println(\"1.Oerson{fun1()}\");\r\n    }\r\n\r\n    public void fun2() {\r\n        System.out.println(\"2.Oerson{fun2()}\");\r\n\r\n    }\r\n}\r\n    \/\/Student\u7c7b\u62d3\u5c55\u81eaPerson\u7c7b\uff0c\u4e5f\u5c31\u7ee7\u627f\u4e86Person\u7c7b\u4e2d\u7684fun1\uff08\uff09\u3001fun2\uff08\uff09\u65b9\u6cd5\r\n    class Student3 extends Java_shilihua\r\n    {\r\n        \/\/\u5728\u8fd9\u91cc\u8986\u5199Person\u7c7b\u4e2d\u7684fun1\uff08\uff09\u65b9\u6cd5\r\n        public void fun1()\r\n        {\r\n            System.out.println(\"3.Oerson{fun1()}\");\r\n        }\r\n        public void fun3()\r\n        {\r\n            System.out.println(\"4.Oerson{fun3()}\");\r\n        }\r\n    }\r\n\r\n\r\n\r\n\r\n\r\n\r\n<\/pre>\n<pre>\/**\r\n * Created by xabcd on 2019\/2\/16.\r\n *\/\r\npublic class Testshilihua\r\n{\r\n    public static void main(String[] args)\r\n    {\r\n        \/\/\u6b64\u5904\uff0c\u7236\u7c7b\u5bf9\u8c61\u7531\u5b50\u7c7b\u5b9e\u4f8b\u5316\r\n\/\/        Java_shilihua p = new Java_shilihua();\r\n        \/\/\u6539\u6210\u4e0b\u9762\u8fd9\u53e5\uff0c\u76f8\u5f53\u4e8e\u662f\u7531\u5b50\u7c7b\u53bb\u5b9e\u4f8b\u5316\u7236\u7c7b\u5bf9\u8c61\r\n        Java_shilihua p = new Student3();\r\n\/\/        \u5c06p\u5bf9\u8c61\u5411\u4e0b\u8f6c\u578b\r\n        Student3 s = (Student3)p;\r\n        p.fun1();\r\n        p.fun2();\r\n    }\r\n}<\/pre>\n<pre>\/**\r\n * Created by xabcd on 2019\/2\/16.\r\n *\/\r\npublic class Testshilihua\r\n{\r\n    public static void main(String[] args)\r\n    {\r\n        \/\/\u6b64\u5904\uff0c\u7236\u7c7b\u5bf9\u8c61\u7531\u5b50\u7c7b\u5b9e\u4f8b\u5316\r\n<span style=\"color: #ff0000;\">\/\/        Java_shilihua p = new Java_shilihua();<\/span>\r\n<span style=\"color: #ff0000;\">        \/\/\u6539\u6210\u4e0b\u9762\u8fd9\u53e5\uff0c\u76f8\u5f53\u4e8e\u662f\u7531\u5b50\u7c7b\u53bb\u5b9e\u4f8b\u5316\u7236\u7c7b\u5bf9\u8c61<\/span>\r\n<span style=\"color: #ff0000;\">        Java_shilihua p = new Student3();<\/span>\r\n\/\/        \u5c06p\u5bf9\u8c61\u5411\u4e0b\u8f6c\u578b\r\n        Student3 s = (Student3)p;\r\n        p.fun1();\r\n        p.fun2();\r\n    }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u8fd9\u91cc \u8981 \u7740\u91cd \u8bb2\u89e3 \u4e24\u4e2a \u6982\u5ff5\uff0c \u5e0c\u671b \u8bfb\u8005 \u4e88\u4ee5 \u91cd\u89c6\u3002 1. \u5411\u4e0a \u8f6c\u578b \u5728\u4e0a \u9762\u7684 \u8303\u4f8b TestJ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,24],"tags":[],"class_list":["post-517","post","type-post","status-publish","format-standard","hentry","category-java","category-base_code"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=517"}],"version-history":[{"count":1,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/517\/revisions"}],"predecessor-version":[{"id":518,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/517\/revisions\/518"}],"wp:attachment":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}