{"id":66916,"date":"2025-05-03T13:18:38","date_gmt":"2025-05-03T05:18:38","guid":{"rendered":"https:\/\/fwq.ai\/blog\/66916\/"},"modified":"2025-05-03T13:18:38","modified_gmt":"2025-05-03T05:18:38","slug":"java%e9%87%8c%e6%80%8e%e4%b9%88%e5%88%9d%e5%a7%8b%e5%8c%96%e4%ba%8c%e7%bb%b4%e6%95%b0%e7%bb%84-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/66916\/","title":{"rendered":"java\u91cc\u600e\u4e48\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4"},"content":{"rendered":"<blockquote><p>\n  java \u4e2d\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\u6709\u4e24\u79cd\u65b9\u6cd5\uff1a1. \u76f4\u63a5\u521d\u59cb\u5316\uff0c\u4f7f\u7528\u5927\u62ec\u53f7\u9010\u884c\u5217\u51fa\u5143\u7d20\uff1b2. \u4f7f\u7528\u6570\u7ec4\u521b\u5efa\u5668\u8bed\u6cd5\uff0c\u7528 new \u5173\u952e\u5b57\u6307\u5b9a\u5927\u5c0f\u5e76\u9010\u884c\u8d4b\u503c\u5143\u7d20\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/17\/2024111718581723357.jpg\" class=\"aligncenter\" title=\"java\u91cc\u600e\u4e48\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\u63d2\u56fe\" alt=\"java\u91cc\u600e\u4e48\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\u63d2\u56fe\" \/><\/p>\n<p><strong>Java \u4e2d\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4<\/strong><\/p>\n<p>\u5728 Java \u4e2d\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\u7684\u65b9\u6cd5\u6709\u4e24\u79cd\uff1a<\/p>\n<p><strong>1. \u76f4\u63a5\u521d\u59cb\u5316<\/strong><\/p>\n<p>\u4f7f\u7528\u5927\u62ec\u53f7\u5c06\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u9010\u4e2a\u5217\u51fa\uff0c\u7136\u540e\u7528\u9017\u53f7\u5206\u9694\u6bcf\u4e00\u884c\u5143\u7d20\u3002\u4f8b\u5982\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>int[][] myArray = {\n    {1, 2, 3},\n    {4, 5, 6},\n    {7, 8, 9}\n};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u4f7f\u7528\u6570\u7ec4\u521b\u5efa\u5668\u8bed\u6cd5<\/strong><\/p>\n<p>\u4f7f\u7528 new \u5173\u952e\u5b57\u521b\u5efa\u4e00\u4e2a\u6307\u5b9a\u5927\u5c0f\u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u7136\u540e\u4f7f\u7528\u5927\u62ec\u53f7\u4e3a\u6bcf\u4e00\u884c\u5143\u7d20\u8d4b\u503c\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>int[][] myArray = new int[3][3];\n\nmyArray[0][0] = 1;\nmyArray[0][1] = 2;\nmyArray[0][2] = 3;\n\nmyArray[1][0] = 4;\nmyArray[1][1] = 5;\nmyArray[1][2] = 6;\n\nmyArray[2][0] = 7;\nmyArray[2][1] = 8;\nmyArray[2][2] = 9;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e8c\u7ef4\u6570\u7ec4\u7684\u7b2c\u4e00\u7ef4\u8868\u793a\u884c\uff0c\u7b2c\u4e8c\u7ef4\u8868\u793a\u5217\u3002<\/li>\n<li>\u5143\u7d20\u4f7f\u7528\u65b9\u62ec\u53f7\u8bbf\u95ee\u3002\u4f8b\u5982\uff0cmyArray[0][0] \u8bbf\u95ee\u7b2c\u4e00\u4e2a\u5143\u7d20\u3002<\/li>\n<li>\u521b\u5efa\u6570\u7ec4\u65f6\uff0c\u5fc5\u987b\u6307\u5b9a\u884c\u6570\u548c\u5217\u6570\uff0c\u5e76\u4e14\u8be5\u5927\u5c0f\u5728\u521b\u5efa\u540e\u65e0\u6cd5\u66f4\u6539\u3002<\/li>\n<li>\u5bf9\u4e8e\u4f7f\u7528 new \u5173\u952e\u5b57\u521b\u5efa\u7684\u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528 length \u5c5e\u6027\u83b7\u53d6\u884c\u6570\u6216\u5217\u6570\u3002\u4f8b\u5982\uff0cmyArray.length \u83b7\u53d6\u884c\u6570\uff0cmyArray[0].length \u83b7\u53d6\u5217\u6570\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u91cc\u600e\u4e48\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\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 \u4e2d\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\u6709\u4e24\u79cd\u65b9\u6cd5\uff1a1. \u76f4\u63a5\u521d\u59cb\u5316\uff0c\u4f7f\u7528\u5927\u62ec\u53f7\u9010\u884c\u5217\u51fa\u5143\u7d20\uff1b2. \u4f7f\u7528\u6570\u7ec4\u521b\u5efa\u5668\u8bed\u6cd5\uff0c\u7528 new \u5173\u952e\u5b57\u6307\u5b9a\u5927\u5c0f\u5e76\u9010\u884c\u8d4b\u503c\u5143\u7d20\u3002 Java \u4e2d\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4 \u5728 Java \u4e2d\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\u7684\u65b9\u6cd5\u6709\u4e24\u79cd\uff1a 1. \u76f4\u63a5\u521d\u59cb\u5316 \u4f7f\u7528\u5927\u62ec\u53f7\u5c06\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u9010\u4e2a\u5217\u51fa\uff0c\u7136\u540e\u7528\u9017\u53f7\u5206\u9694\u6bcf\u4e00\u884c\u5143\u7d20\u3002\u4f8b\u5982\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b int[][] myArray = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; \u767b\u5f55\u540e\u590d\u5236 2. \u4f7f\u7528\u6570\u7ec4\u521b\u5efa\u5668\u8bed\u6cd5 \u4f7f\u7528 new \u5173\u952e\u5b57\u521b\u5efa\u4e00\u4e2a\u6307\u5b9a\u5927\u5c0f\u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u7136\u540e\u4f7f\u7528\u5927\u62ec\u53f7\u4e3a\u6bcf\u4e00\u884c\u5143\u7d20\u8d4b\u503c\u3002\u4f8b\u5982\uff1a int[][] myArray = new int[3][3]; myArray[0][0] = 1; myArray[0][1] = 2; myArray[0][2] = 3; myArray[1][0] = 4; myArray[1][1] = 5; [&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-66916","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/66916","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=66916"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/66916\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=66916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=66916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=66916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}