{"id":37086,"date":"2024-11-26T08:47:52","date_gmt":"2024-11-26T00:47:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/37086\/"},"modified":"2024-11-26T08:47:52","modified_gmt":"2024-11-26T00:47:52","slug":"java%e6%80%8e%e4%b9%88%e6%8a%8a%e6%95%b0%e7%bb%84b%e8%b5%8b%e7%bb%99%e6%95%b0%e7%bb%84a","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/37086\/","title":{"rendered":"java\u600e\u4e48\u628a\u6570\u7ec4b\u8d4b\u7ed9\u6570\u7ec4a"},"content":{"rendered":"<blockquote><p>\n  \u901a\u8fc7\u8d4b\u503c\u8fd0\u7b97\u7b26 =\uff0c\u53ef\u4ee5\u5c06\u6570\u7ec4 b \u8d4b\u7ed9\u6570\u7ec4 a\uff0c\u4f46\u4ec5\u590d\u5236\u6570\u7ec4\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5143\u7d20\u3002\u5bf9\u4e00\u4e2a\u6570\u7ec4\u7684\u66f4\u6539\u4f1a\u53cd\u6620\u5728\u53e6\u4e00\u4e2a\u6570\u7ec4\u4e2d\uff0c\u5982\u679c\u957f\u5ea6\u4e0d\u540c\uff0c\u5219\u6570\u7ec4 a \u5c06\u88ab\u8c03\u6574\u5927\u5c0f\uff0c\u4e4b\u524d\u5143\u7d20\u5c06\u88ab\u8986\u76d6\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/13\/2024111300550935653.jpg\" class=\"aligncenter\" title=\"java\u600e\u4e48\u628a\u6570\u7ec4b\u8d4b\u7ed9\u6570\u7ec4a\u63d2\u56fe\" alt=\"java\u600e\u4e48\u628a\u6570\u7ec4b\u8d4b\u7ed9\u6570\u7ec4a\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5c06\u6570\u7ec4 b \u8d4b\u7ed9\u6570\u7ec4 a<\/strong><\/p>\n<p>\u5728 Java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u8d4b\u503c\u8fd0\u7b97\u7b26 = \u5c06\u6570\u7ec4 b \u8d4b\u7ed9\u6570\u7ec4 a\uff1a<\/p>\n<pre>int[] a = new int[5];\nint[] b = {1, 2, 3, 4, 5};\n\na = b;\n\nSystem.out.println(a[0]); \/\/ \u8f93\u51fa\uff1a1<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6ce8\u610f\uff1a<\/p>\n<ul>\n<li>\u8fd9\u79cd\u65b9\u6cd5\u4ec5\u590d\u5236\u6570\u7ec4\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5143\u7d20\u3002\u8fd9\u610f\u5473\u7740\u5bf9\u6570\u7ec4 a \u8fdb\u884c\u7684\u4efb\u4f55\u66f4\u6539\u90fd\u5c06\u53cd\u6620\u5728\u6570\u7ec4 b \u4e2d\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002<\/li>\n<li>\u5982\u679c\u6570\u7ec4 a \u548c b \u5177\u6709\u4e0d\u540c\u7684\u957f\u5ea6\uff0c\u5219\u6570\u7ec4 a \u5c06\u88ab\u8c03\u6574\u5927\u5c0f\u4ee5\u5339\u914d\u6570\u7ec4 b \u7684\u957f\u5ea6\u3002<\/li>\n<li>\u5982\u679c\u6570\u7ec4 a \u4e4b\u524d\u5305\u542b\u4efb\u4f55\u5143\u7d20\uff0c\u5219\u8fd9\u4e9b\u5143\u7d20\u5c06\u88ab\u8986\u76d6\u3002<\/li>\n<\/ul>\n<p><strong>\u8be6\u7ec6\u89e3\u91ca\uff1a<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5728 Java \u4e2d\uff0c\u6570\u7ec4\u662f\u4e00\u4e2a\u5f15\u7528\u7c7b\u578b\u3002\u8fd9\u610f\u5473\u7740\u6570\u7ec4\u53d8\u91cf\u5b58\u50a8\u7684\u662f\u6570\u7ec4\u7684\u5185\u5b58\u5730\u5740\uff0c\u800c\u4e0d\u662f\u6570\u7ec4\u672c\u8eab\u3002\u5f53\u4f7f\u7528\u8d4b\u503c\u8fd0\u7b97\u7b26 = \u65f6\uff0c\u5b83\u5c06\u6570\u7ec4 b \u7684\u5185\u5b58\u5730\u5740\u590d\u5236\u5230\u6570\u7ec4 a \u7684\u53d8\u91cf\u4e2d\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u6570\u7ec4 a \u548c b \u5b9e\u9645\u4e0a\u6307\u5411\u540c\u4e00\u4e2a\u5185\u5b58\u4f4d\u7f6e\u3002\u5bf9\u5176\u4e2d\u4efb\u4f55\u4e00\u4e2a\u6570\u7ec4\u8fdb\u884c\u7684\u66f4\u6539\u90fd\u5c06\u540c\u65f6\u5f71\u54cd\u53e6\u4e00\u4e2a\u6570\u7ec4\u3002<\/p>\n<p>\u5982\u679c\u6570\u7ec4 a \u548c b \u5177\u6709\u4e0d\u540c\u7684\u957f\u5ea6\uff0c\u5219 JVM \u5c06\u81ea\u52a8\u8c03\u6574\u6570\u7ec4 a \u7684\u5927\u5c0f\u4ee5\u5339\u914d\u6570\u7ec4 b \u7684\u5927\u5c0f\u3002\u4efb\u4f55\u8d85\u8fc7\u6570\u7ec4 b \u957f\u5ea6\u7684\u5143\u7d20\u5c06\u88ab\u4e22\u5f03\u3002<\/p>\n<p>\u6700\u540e\uff0c\u5982\u679c\u6570\u7ec4 a \u4e4b\u524d\u5305\u542b\u4efb\u4f55\u5143\u7d20\uff0c\u5219\u8fd9\u4e9b\u5143\u7d20\u5c06\u88ab\u8986\u76d6\uff0c\u5e76\u7528\u6570\u7ec4 b \u4e2d\u7684\u5143\u7d20\u66ff\u6362\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u600e\u4e48\u628a\u6570\u7ec4b\u8d4b\u7ed9\u6570\u7ec4a\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7\u8d4b\u503c\u8fd0\u7b97\u7b26 =\uff0c\u53ef\u4ee5\u5c06\u6570\u7ec4 b \u8d4b\u7ed9\u6570\u7ec4 a\uff0c\u4f46\u4ec5\u590d\u5236\u6570\u7ec4\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5143\u7d20\u3002\u5bf9\u4e00\u4e2a\u6570\u7ec4\u7684\u66f4\u6539\u4f1a\u53cd\u6620\u5728\u53e6\u4e00\u4e2a\u6570\u7ec4\u4e2d\uff0c\u5982\u679c\u957f\u5ea6\u4e0d\u540c\uff0c\u5219\u6570\u7ec4 a \u5c06\u88ab\u8c03\u6574\u5927\u5c0f\uff0c\u4e4b\u524d\u5143\u7d20\u5c06\u88ab\u8986\u76d6\u3002 \u5982\u4f55\u5c06\u6570\u7ec4 b \u8d4b\u7ed9\u6570\u7ec4 a \u5728 Java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u8d4b\u503c\u8fd0\u7b97\u7b26 = \u5c06\u6570\u7ec4 b \u8d4b\u7ed9\u6570\u7ec4 a\uff1a int[] a = new int[5]; int[] b = {1, 2, 3, 4, 5}; a = b; System.out.println(a[0]); \/\/ \u8f93\u51fa\uff1a1 \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\uff1a \u8fd9\u79cd\u65b9\u6cd5\u4ec5\u590d\u5236\u6570\u7ec4\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u5b9e\u9645\u5143\u7d20\u3002\u8fd9\u610f\u5473\u7740\u5bf9\u6570\u7ec4 a \u8fdb\u884c\u7684\u4efb\u4f55\u66f4\u6539\u90fd\u5c06\u53cd\u6620\u5728\u6570\u7ec4 b \u4e2d\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002 \u5982\u679c\u6570\u7ec4 a \u548c b \u5177\u6709\u4e0d\u540c\u7684\u957f\u5ea6\uff0c\u5219\u6570\u7ec4 a \u5c06\u88ab\u8c03\u6574\u5927\u5c0f\u4ee5\u5339\u914d\u6570\u7ec4 b \u7684\u957f\u5ea6\u3002 \u5982\u679c\u6570\u7ec4 [&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-37086","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/37086","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=37086"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/37086\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=37086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=37086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=37086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}