{"id":586,"date":"2022-09-29T21:51:44","date_gmt":"2022-09-29T13:51:44","guid":{"rendered":"https:\/\/qaqaq.top\/?p=586"},"modified":"2022-11-27T12:39:59","modified_gmt":"2022-11-27T04:39:59","slug":"%e9%9d%a2%e5%90%91%e5%af%b9%e8%b1%a1%e4%b8%8a-%e6%96%b0%e7%89%b9%e6%80%a7%ef%bc%9a%e5%8f%af%e5%8f%98%e4%b8%aa%e6%95%b0%e5%bd%a2%e5%8f%82%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/qaqaq.top\/?p=586","title":{"rendered":"\u9762\u5411\u5bf9\u8c61(\u4e0a)-\u65b0\u7279\u6027\uff1a\u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u7684\u65b9\u6cd5"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P209;\r\n\/*\r\n * \u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u7684\u65b9\u6cd5\r\n * \r\n * 1. jdk 5.0\u65b0\u589e\u7684\u5185\u5bb9\r\n * 2. \u5177\u4f53\u4f7f\u7528\uff1a\r\n * \t\t2.1 \u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u7684\u683c\u5f0f\uff1a\u6570\u636e\u7c7b\u578b ... \u53d8\u91cf\u540d\r\n * \t\t2.2 \u5f53\u8c03\u7528\u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u7684\u65b9\u6cd5\u65f6\uff0c\u4f20\u5165\u7684\u53c2\u6570\u4e2a\u6570\u53ef\u4ee5\u662f\uff1a0\u4e2a\uff0c1\u4e2a\uff0c2\u4e2a\uff0c\u3002\u3002\u3002\r\n * \t\t2.3 \u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u7684\u65b9\u6cd5\u4e0e\u672c\u7c7b\u4e2d\u65b9\u6cd5\u540d\u76f8\u540c\uff0c\u5f62\u53c2\u4e0d\u540c\u7684\u65b9\u6cd5\u4e4b\u95f4\u6784\u6210\u91cd\u8f7d\r\n * \t\t2.4 \u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u7684\u65b9\u6cd5\u4e0e\u672c\u7c7b\u4e2d\u65b9\u6cd5\u540d\u76f8\u540c\uff0c\u5f62\u53c2\u7c7b\u578b\u4e5f\u76f8\u540c\u7684\u6570\u7ec4\u4e4b\u95f4\u4e0d\u6784\u6210\u91cd\u8f7d\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u4e8c\u8005\u4e0d\u80fd\u5171\u5b58\u3002\r\n * \t\t2.5 \u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u5728\u65b9\u6cd5\u7684\u5f62\u53c2\u4e2d\uff0c\u5fc5\u987b\u58f0\u660e\u5728\u672b\u5c3e\r\n * \t\t2.6 \u53ef\u53d8\u4e2a\u6570\u5f62\u53c2\u5728\u65b9\u6cd5\u7684\u5f62\u53c2\u4e2d\uff0c\u6700\u591a\u53ea\u80fd\u58f0\u660e\u4e00\u4e2a\u53ef\u53d8\u5f62\u53c2\u3002\r\n * \r\n *\/\r\npublic class MethodArgsTest {\r\n\t\r\n\tpublic static void main(String&#91;] args) {\r\n\t\t\r\n\t\tMethodArgsTest test = new MethodArgsTest();\r\n\t\ttest.show(12);\r\n\/\/\t\ttest.show(\"hello\");\r\n\/\/\t\ttest.show(\"hello\",\"world\");\r\n\/\/\t\ttest.show();\r\n\t\t\r\n\t\ttest.show(new String&#91;]{\"AA\",\"BB\",\"CC\"});\r\n\t}\r\n\r\n\tpublic void show(int i) {\r\n\t\t\r\n\t}\r\n\t\r\n\tpublic void show(String s) {\r\n\t\tSystem.out.println(\"show(String)\");\r\n\t\t\r\n\t}\r\n\t\r\n\tpublic void show(String ... strs) {\r\n\t\tSystem.out.println(\"show(String ... strs)\");\r\n\t\t\r\n\t\tfor(int i = 0; i &lt; strs.length; i++) {\r\n\t\t\tSystem.out.println(strs&#91;i]);\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\r\n\/\/\tpublic void show(String&#91;] strs) {\r\n\/\/\t\t\r\n\/\/\t}\r\n\t\r\n\t\/\/The variable argument type String of the method \r\n\t\/\/show must be the last parameter\r\n\/\/\tpublic void show(String ... strs,int i) {\r\n\/\/\t\t\r\n\/\/\t}\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-586","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\/586"}],"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=586"}],"version-history":[{"count":1,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/586\/revisions"}],"predecessor-version":[{"id":587,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/586\/revisions\/587"}],"wp:attachment":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}