{"id":597,"date":"2022-09-29T22:14:39","date_gmt":"2022-09-29T14:14:39","guid":{"rendered":"https:\/\/qaqaq.top\/?p=597"},"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%8e%a2%e8%ae%a8%e5%87%a0%e9%81%93%e7%bd%91%e7%ba%a2%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/qaqaq.top\/?p=597","title":{"rendered":"\u9762\u5411\u5bf9\u8c61(\u4e0a)-\u63a2\u8ba8\u51e0\u9053\u7f51\u7ea2\u95ee\u9898"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P214;\r\n\r\nimport java.io.PrintStream;\r\n\r\npublic class Test1 {\r\n\t\r\n\tpublic static void main(String&#91;] args) {\r\n\t\tint a = 10;\r\n\t\tint b = 10;\r\n\t\t\r\n\t\tmethod(a,b);\/\/\u9700\u8981\u5728method\u65b9\u6cd5\u88ab\u8c03\u7528\u4e4b\u540e\uff0c\u4ec5\u6253\u5370\u51faa=100,b=200\uff0c\u8bf7\u5199\u51famethod\u65b9\u6cd5\u7684\u4ee3\u7801\r\n\t\t\r\n\t\tSystem.out.println(\"a=\" + a);\r\n\t\tSystem.out.println(\"b=\" + b);\r\n\t}\r\n\r\n\t\/\/\u4ee3\u7801\u7f16\u5199\u5904\r\n\t\r\n\t\/\/\u65b9\u6cd5\u4e00\r\n\/\/\tpublic static void method(int a, int b) {\r\n\/\/\t\ta = a * 10;\r\n\/\/\t\tb = b * 20;\r\n\/\/\t\tSystem.out.println(a);\r\n\/\/\t\tSystem.out.println(b);\r\n\/\/\t\tSystem.exit(0);\r\n\/\/\t}\r\n\t\r\n\t\/\/\u65b9\u6cd5\u4e8c\r\n\tpublic static void method(int a, int b) {\r\n\t\tPrintStream ps = new PrintStream(System.out) {\r\n\t\t\t@Override\r\n\t\t\tpublic void println(String x) {\r\n\t\t\t\tif(\"a=10\".equals(x)) {\r\n\t\t\t\t\tx = \"a = 100\";\r\n\t\t\t\t}else if(\"b=10\".equals(x)) {\r\n\t\t\t\t\tx = \"b = 200\";\r\n\t\t\t\t}\r\n\t\t\t\tsuper.println(x);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tSystem.setOut(ps);\r\n\t}\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P214;\r\n\/*\r\n * \u5fae\u8f6f\uff1a\r\n\t\u5b9a\u4e49\u4e00\u4e2aint\u578b\u7684\u6570\u7ec4\uff1aint&#91;] arr = new int&#91;]{12,3,3,34,56,77,432};\r\n\t\u8ba9\u6570\u7ec4\u7684\u6bcf\u4e2a\u4f4d\u7f6e\u4e0a\u7684\u503c\u53bb\u9664\u4ee5\u9996\u4f4d\u7f6e\u7684\u5143\u7d20\uff0c\u5f97\u5230\u7684\u7ed3\u679c\uff0c\u4f5c\u4e3a\u8be5\u4f4d\u7f6e\u4e0a\u7684\r\n\t\u65b0\u503c\u3002\u904d\u5386\u65b0\u7684\u6570\u7ec4\u3002\r\n * \r\n * \r\n * \r\n * \r\n *\/\r\npublic class Test2 {\r\n\t\r\n\tpublic static void main(String&#91;] args) {\r\n\t\t\r\n\t\tint&#91;] arr = new int&#91;] {12,3,3,34,56,77,432};\r\n\t\t\r\n\t\t\/\/\u9519\u8bef\u5199\u6cd5\r\n\/\/\t\tfor(int i = 0; i &lt; arr.length; i++) {\r\n\/\/\t\t\tarr&#91;i] = arr&#91;i] \/ arr&#91;0];\r\n\/\/\t\t}\r\n\t\t\r\n\t\t\/\/\u6b63\u786e\u5199\u6cd51\r\n\/\/\t\tfor(int i = arr.length - 1; i >=0; i--) {\r\n\/\/\t\t\tarr&#91;i] = arr&#91;i] \/ arr&#91;0];\r\n\/\/\t\t}\r\n\t\t\r\n\t\t\/\/\u6b63\u786e\u5199\u6cd52\r\n\t\tint temp = arr&#91;0];\r\n\t\tfor(int i = 0; i &lt; arr.length; i++) {\r\n\t\tarr&#91;i] = arr&#91;i] \/ temp;\r\n\t}\r\n\t\t\r\n\t\tfor(int i = 0; i &lt; arr.length; i++) {\r\n\t\t\tSystem.out.println(arr&#91;i]);\r\n\t\t}\r\n\t\t\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.P214;\r\n\r\npublic class ArrayPrintTest {\r\n\t\r\n\tpublic static void main(String&#91;] args) {\r\n\t\t\r\n\t\tint&#91;] arr = new int&#91;] {1,2,3};\r\n\t\tSystem.out.println(arr);\/\/\u5730\u5740\u503c\r\n\t\t\r\n\t\tchar&#91;] arr1 = new char&#91;] {'a','b','c'};\r\n\t\tSystem.out.println(arr1);\/\/abc\r\n\t}\r\n\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-597","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\/597"}],"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=597"}],"version-history":[{"count":1,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions"}],"predecessor-version":[{"id":598,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions\/598"}],"wp:attachment":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}