{"id":65627,"date":"2025-05-03T14:01:48","date_gmt":"2025-05-03T06:01:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/65627\/"},"modified":"2025-05-03T14:01:48","modified_gmt":"2025-05-03T06:01:48","slug":"java%e6%95%b0%e7%bb%84%e5%81%9a%e5%8f%82%e6%95%b0%e6%80%8e%e4%b9%88%e4%bc%a0%e9%80%92-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/65627\/","title":{"rendered":"java\u6570\u7ec4\u505a\u53c2\u6570\u600e\u4e48\u4f20\u9012"},"content":{"rendered":"<blockquote><p>\n  java\u6570\u7ec4\u4f20\u9012\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a\u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012\uff1a\u6570\u7ec4\u5b9e\u9645\u662f\u5bf9\u8c61\uff0c\u4f20\u9012\u526f\u672c\uff0c\u4e0d\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\u3002\u4f5c\u4e3a\u5f15\u7528\u4f20\u9012\uff1a\u4f20\u9012\u6570\u7ec4\u5f15\u7528\uff0c\u4fee\u6539\u4f20\u9012\u7684\u5f15\u7528\u4f1a\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\uff0c\u5bf9\u8c03\u7528\u5b83\u7684\u65b9\u6cd5\u4e2d\u7684\u6570\u7ec4\u4fee\u6539\u4e5f\u4f1a\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/13\/2024111305515599927.jpg\" class=\"aligncenter\" title=\"java\u6570\u7ec4\u505a\u53c2\u6570\u600e\u4e48\u4f20\u9012\u63d2\u56fe\" alt=\"java\u6570\u7ec4\u505a\u53c2\u6570\u600e\u4e48\u4f20\u9012\u63d2\u56fe\" \/><\/p>\n<p><strong>Java\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012<\/strong><\/p>\n<p><strong>\u5982\u4f55\u4f20\u9012?<\/strong><\/p>\n<p>Java\u6570\u7ec4\u53ef\u4ee5\u901a\u8fc7\u4e24\u4e2a\u65b9\u5f0f\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\uff1a<\/p>\n<ul>\n<li> <strong>\u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012\uff1a<\/strong>\u6570\u7ec4\u5728Java\u4e2d\u5b9e\u9645\u4e0a\u662f\u5bf9\u8c61\uff0c\u56e0\u6b64\u53ef\u4ee5\u50cf\u5176\u4ed6\u5bf9\u8c61\u4e00\u6837\u4f20\u9012\u7ed9\u65b9\u6cd5\u3002<\/li>\n<li> <strong>\u4f5c\u4e3a\u5f15\u7528\u4f20\u9012\uff1a<\/strong>\u6570\u7ec4\u7684\u5f15\u7528\u53ef\u4ee5\u4f20\u9012\u7ed9\u65b9\u6cd5\uff0c\u8fd9\u5b9e\u9645\u4e0a\u4f20\u9012\u7684\u662f\u6307\u5411\u6570\u7ec4\u5728\u5185\u5b58\u4e2d\u4f4d\u7f6e\u7684\u6307\u9488\u3002<\/li>\n<\/ul>\n<p><strong>\u8be6\u7ec6\u8bf4\u660e\uff1a<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012<\/strong><\/p>\n<p>\u5c06\u6570\u7ec4\u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012\u65f6\uff0c\u521b\u5efa\u6570\u7ec4\u7684\u65b0\u526f\u672c\u5e76\u5c06\u5176\u4f20\u9012\u7ed9\u65b9\u6cd5\u3002\u8fd9\u610f\u5473\u7740\u5bf9\u4f20\u9012\u7684\u526f\u672c\u6240\u505a\u7684\u4efb\u4f55\u66f4\u6539\u90fd\u4e0d\u4f1a\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\u3002<\/p>\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>public static void printArray(int[] arr) {\n  for (int i : arr) {\n    System.out.print(i + \" \");\n  }\n  System.out.println();\n}\n\npublic static void main(String[] args) {\n  int[] arr = {1, 2, 3};\n  printArray(arr); \/\/ \u8f93\u51fa\uff1a1 2 3\n  arr[0] = 4;\n  printArray(arr); \/\/ \u8f93\u51fa\uff1a4 2 3\uff08\u539f\u59cb\u6570\u7ec4\u5df2\u4fee\u6539\uff09\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f5c\u4e3a\u5f15\u7528\u4f20\u9012<\/strong><\/p>\n<p>\u5c06\u6570\u7ec4\u7684\u5f15\u7528\u4f20\u9012\u65f6\uff0c\u4f20\u9012\u7684\u662f\u6307\u5411\u6570\u7ec4\u5728\u5185\u5b58\u4e2d\u4f4d\u7f6e\u7684\u6307\u9488\u3002\u56e0\u6b64\uff0c\u5bf9\u4f20\u9012\u7684\u5f15\u7528\u6240\u505a\u7684\u4efb\u4f55\u66f4\u6539\u90fd\u4f1a\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\u3002<\/p>\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>public static void changeArray(int[] arr) {\n  arr[0] = 5;\n}\n\npublic static void main(String[] args) {\n  int[] arr = {1, 2, 3};\n  changeArray(arr);\n  printArray(arr); \/\/ \u8f93\u51fa\uff1a5 2 3\uff08\u539f\u59cb\u6570\u7ec4\u5df2\u4fee\u6539\uff09\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<p>\u4f20\u9012\u6570\u7ec4\u7684\u5f15\u7528\u65f6\uff0c\u65b9\u6cd5\u4e2d\u5bf9\u6570\u7ec4\u7684\u4fee\u6539\u4e5f\u4f1a\u5f71\u54cd\u8c03\u7528\u5b83\u7684\u65b9\u6cd5\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>public static void printAndChangeArray(int[] arr) {\n  printArray(arr); \/\/ \u8f93\u51fa\uff1a1 2 3\n  arr[0] = 4;\n}\n\npublic static void main(String[] args) {\n  int[] arr = {1, 2, 3};\n  printAndChangeArray(arr);\n  printArray(arr); \/\/ \u8f93\u51fa\uff1a4 2 3\uff08\u539f\u59cb\u6570\u7ec4\u5df2\u4fee\u6539\uff09\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u6570\u7ec4\u505a\u53c2\u6570\u600e\u4e48\u4f20\u9012\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>java\u6570\u7ec4\u4f20\u9012\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a\u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012\uff1a\u6570\u7ec4\u5b9e\u9645\u662f\u5bf9\u8c61\uff0c\u4f20\u9012\u526f\u672c\uff0c\u4e0d\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\u3002\u4f5c\u4e3a\u5f15\u7528\u4f20\u9012\uff1a\u4f20\u9012\u6570\u7ec4\u5f15\u7528\uff0c\u4fee\u6539\u4f20\u9012\u7684\u5f15\u7528\u4f1a\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\uff0c\u5bf9\u8c03\u7528\u5b83\u7684\u65b9\u6cd5\u4e2d\u7684\u6570\u7ec4\u4fee\u6539\u4e5f\u4f1a\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\u3002 Java\u6570\u7ec4\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012 \u5982\u4f55\u4f20\u9012? Java\u6570\u7ec4\u53ef\u4ee5\u901a\u8fc7\u4e24\u4e2a\u65b9\u5f0f\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\uff1a \u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012\uff1a\u6570\u7ec4\u5728Java\u4e2d\u5b9e\u9645\u4e0a\u662f\u5bf9\u8c61\uff0c\u56e0\u6b64\u53ef\u4ee5\u50cf\u5176\u4ed6\u5bf9\u8c61\u4e00\u6837\u4f20\u9012\u7ed9\u65b9\u6cd5\u3002 \u4f5c\u4e3a\u5f15\u7528\u4f20\u9012\uff1a\u6570\u7ec4\u7684\u5f15\u7528\u53ef\u4ee5\u4f20\u9012\u7ed9\u65b9\u6cd5\uff0c\u8fd9\u5b9e\u9645\u4e0a\u4f20\u9012\u7684\u662f\u6307\u5411\u6570\u7ec4\u5728\u5185\u5b58\u4e2d\u4f4d\u7f6e\u7684\u6307\u9488\u3002 \u8be6\u7ec6\u8bf4\u660e\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012 \u5c06\u6570\u7ec4\u4f5c\u4e3a\u5bf9\u8c61\u4f20\u9012\u65f6\uff0c\u521b\u5efa\u6570\u7ec4\u7684\u65b0\u526f\u672c\u5e76\u5c06\u5176\u4f20\u9012\u7ed9\u65b9\u6cd5\u3002\u8fd9\u610f\u5473\u7740\u5bf9\u4f20\u9012\u7684\u526f\u672c\u6240\u505a\u7684\u4efb\u4f55\u66f4\u6539\u90fd\u4e0d\u4f1a\u5f71\u54cd\u539f\u59cb\u6570\u7ec4\u3002 \u4ee3\u7801\u793a\u4f8b\uff1a public static void printArray(int[] arr) { for (int i : arr) { System.out.print(i + &#8221; &#8220;); } System.out.println(); } public static void main(String[] args) { int[] arr = {1, 2, 3}; printArray(arr); \/\/ \u8f93\u51fa\uff1a1 2 3 arr[0] = 4; printArray(arr); \/\/ \u8f93\u51fa\uff1a4 2 3\uff08\u539f\u59cb\u6570\u7ec4\u5df2\u4fee\u6539\uff09 [&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-65627","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/65627","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=65627"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/65627\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=65627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=65627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=65627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}