{"id":65449,"date":"2025-05-03T12:46:46","date_gmt":"2025-05-03T04:46:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/65449\/"},"modified":"2025-05-03T12:46:46","modified_gmt":"2025-05-03T04:46:46","slug":"java%e6%80%8e%e4%b9%88%e4%bc%a0%e9%80%92%e6%95%b0%e7%bb%84%e4%bd%9c%e4%b8%ba%e5%8f%82%e6%95%b0-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/65449\/","title":{"rendered":"java\u600e\u4e48\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570"},"content":{"rendered":"<blockquote><p>\n  \u5728 java \u4e2d\uff0c\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a1. \u76f4\u63a5\u4f20\u9012\u6570\u7ec4\uff0c\u4f20\u9012\u7684\u662f\u6570\u7ec4\u526f\u672c\uff1b2. \u4f20\u9012\u6570\u7ec4\u5f15\u7528\uff0c\u901a\u8fc7\u521d\u59cb\u5316\u6570\u7ec4\u5f15\u7528\u6765\u4fee\u6539\u65b9\u6cd5\u4e2d\u6570\u7ec4\u7684\u5185\u5bb9\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/13\/2024111301152388929.jpg\" class=\"aligncenter\" title=\"java\u600e\u4e48\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\u63d2\u56fe\" alt=\"java\u600e\u4e48\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Java \u4e2d\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570<\/strong><\/p>\n<p>\u5728 Java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\uff1a<\/p>\n<p><strong>1. \u76f4\u63a5\u4f20\u9012\u6570\u7ec4<\/strong><\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u662f\u6700\u7b80\u5355\u7684\uff0c\u53ea\u9700\u8981\u5c06\u6570\u7ec4\u540d\u79f0\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u7ed9\u65b9\u6cd5\u5373\u53ef\u3002\u7136\u800c\uff0c\u4f20\u9012\u7684\u6570\u7ec4\u526f\u672c\uff0c\u800c\u4e0d\u662f\u539f\u59cb\u6570\u7ec4\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>public static void printArray(int[] arr) {\n  for (int i = 0; i &lt; arr.length; i++) {\n    System.out.println(arr[i]);\n  }\n}\n\npublic static void main(String[] args) {\n  int[] arr = {1, 2, 3, 4, 5};\n  printArray(arr);\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u4f20\u9012\u6570\u7ec4\u5f15\u7528<\/strong><\/p>\n<p>\u901a\u8fc7\u4f20\u9012\u6570\u7ec4\u5f15\u7528\uff0c\u53ef\u4ee5\u4fee\u6539\u65b9\u6cd5\u4e2d\u6570\u7ec4\u7684\u5185\u5bb9\u3002\u8981\u505a\u5230\u8fd9\u4e00\u70b9\uff0c\u9700\u8981\u58f0\u660e\u4e00\u4e2a int[] \u7c7b\u578b\u7684\u53c2\u6570\uff0c\u5e76\u5728\u65b9\u6cd5\u7684\u5f00\u5934\u5c06\u5176\u521d\u59cb\u5316\u4e3a\u4f20\u5165\u6570\u7ec4\u7684\u5f15\u7528\u3002<\/p>\n<pre>public static void modifyArray(int[] arr) {\n  for (int i = 0; i &lt; arr.length; i++) {\n    arr[i] *= 2;\n  }\n}\n\npublic static void main(String[] args) {\n  int[] arr = {1, 2, 3, 4, 5};\n  modifyArray(arr);\n  for (int i = 0; i &lt; arr.length; i++) {\n    System.out.println(arr[i]);\n  }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0cmodifyArray \u65b9\u6cd5\u4fee\u6539\u4e86\u4f20\u9012\u7684\u6570\u7ec4\uff0c\u800c\u4e0d\u662f\u5176\u526f\u672c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u600e\u4e48\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 java \u4e2d\uff0c\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a1. \u76f4\u63a5\u4f20\u9012\u6570\u7ec4\uff0c\u4f20\u9012\u7684\u662f\u6570\u7ec4\u526f\u672c\uff1b2. \u4f20\u9012\u6570\u7ec4\u5f15\u7528\uff0c\u901a\u8fc7\u521d\u59cb\u5316\u6570\u7ec4\u5f15\u7528\u6765\u4fee\u6539\u65b9\u6cd5\u4e2d\u6570\u7ec4\u7684\u5185\u5bb9\u3002 \u5982\u4f55\u5728 Java \u4e2d\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570 \u5728 Java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u4f20\u9012\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\uff1a 1. \u76f4\u63a5\u4f20\u9012\u6570\u7ec4 \u8fd9\u79cd\u65b9\u6cd5\u662f\u6700\u7b80\u5355\u7684\uff0c\u53ea\u9700\u8981\u5c06\u6570\u7ec4\u540d\u79f0\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u7ed9\u65b9\u6cd5\u5373\u53ef\u3002\u7136\u800c\uff0c\u4f20\u9012\u7684\u6570\u7ec4\u526f\u672c\uff0c\u800c\u4e0d\u662f\u539f\u59cb\u6570\u7ec4\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b public static void printArray(int[] arr) { for (int i = 0; i &lt; arr.length; i++) { System.out.println(arr[i]); } } public static void main(String[] args) { int[] arr = {1, 2, 3, 4, 5}; printArray(arr); } \u767b\u5f55\u540e\u590d\u5236 2. \u4f20\u9012\u6570\u7ec4\u5f15\u7528 \u901a\u8fc7\u4f20\u9012\u6570\u7ec4\u5f15\u7528\uff0c\u53ef\u4ee5\u4fee\u6539\u65b9\u6cd5\u4e2d\u6570\u7ec4\u7684\u5185\u5bb9\u3002\u8981\u505a\u5230\u8fd9\u4e00\u70b9\uff0c\u9700\u8981\u58f0\u660e\u4e00\u4e2a int[] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-65449","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/65449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=65449"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/65449\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=65449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=65449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=65449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}