{"id":40054,"date":"2024-11-26T13:51:44","date_gmt":"2024-11-26T05:51:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/40054\/"},"modified":"2024-11-26T13:51:44","modified_gmt":"2024-11-26T05:51:44","slug":"java%e9%87%8c%e4%ba%8c%e7%bb%b4%e6%95%b0%e7%bb%84%e6%80%8e%e4%b9%88%e9%80%90%e4%b8%80%e8%b5%8b%e5%80%bc","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/40054\/","title":{"rendered":"java\u91cc\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u9010\u4e00\u8d4b\u503c"},"content":{"rendered":"<blockquote><p>\n  \u4e8c\u7ef4\u6570\u7ec4\u8d4b\u503c\u65b9\u6cd5\uff1a\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u5e76\u521d\u59cb\u5316\u3002\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u904d\u5386\u884c\u548c\u5217\u3002\u4e3a\u6bcf\u4e2a\u5143\u7d20\u8d4b\u503c\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/17\/2024111719222243412.jpg\" class=\"aligncenter\" title=\"java\u91cc\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u9010\u4e00\u8d4b\u503c\u63d2\u56fe\" alt=\"java\u91cc\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u9010\u4e00\u8d4b\u503c\u63d2\u56fe\" \/><\/p>\n<p><strong>Java\u4e2d\u4e3a\u4e8c\u7ef4\u6570\u7ec4\u9010\u4e00\u8d4b\u503c\u7684\u65b9\u6cd5<\/strong><\/p>\n<p>Java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5faa\u73af\u9010\u4e00\u4e3a\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u8d4b\u503c\u3002\u4ee5\u4e0b\u662f\u4e00\u79cd\u5e38\u89c1\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li><strong>\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u5e76\u521d\u59cb\u5316<\/strong><\/li>\n<\/ol>\n<pre>int[][] array = new int[rows][columns];<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff0crows \u548c columns \u5206\u522b\u8868\u793a\u4e8c\u7ef4\u6570\u7ec4\u7684\u884c\u6570\u548c\u5217\u6570\u3002<\/p>\n<ol>\n<li><strong>\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u8d4b\u503c<\/strong><\/li>\n<\/ol>\n<pre>for (int i = 0; i &lt; array.length; i++) {\n    for (int j = 0; j &lt; array[i].length; j++) {\n        array[i][j] = value;\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li><strong>\u5177\u4f53\u793a\u4f8b<\/strong><\/li>\n<\/ol>\n<p>\u4ee5\u4e0b\u793a\u4f8b\u4e3a\u4e00\u4e2a 2 \u884c 3 \u5217\u7684\u4e8c\u7ef4\u6570\u7ec4\u8d4b\u503c\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>int[][] array = new int[2][3];\n\nfor (int i = 0; i &lt; 2; i++) {\n    for (int j = 0; j &lt; 3; j++) {\n        array[i][j] = i * 3 + j + 1;\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8d4b\u503c\u7684\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre>[[1, 2, 3],\n [4, 5, 6]]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u65b9\u6cd5\u53ef\u4ee5\u9010\u4e00\u4e3a\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\u8d4b\u503c\uff0c\u5b83\u4eec\u5728 Java \u5f00\u53d1\u4e2d\u5e7f\u6cdb\u5e94\u7528\u4e8e\u6570\u636e\u5b58\u50a8\u3001\u5904\u7406\u548c\u5206\u6790\u7b49\u573a\u666f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u91cc\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u9010\u4e00\u8d4b\u503c\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>\u4e8c\u7ef4\u6570\u7ec4\u8d4b\u503c\u65b9\u6cd5\uff1a\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u5e76\u521d\u59cb\u5316\u3002\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u904d\u5386\u884c\u548c\u5217\u3002\u4e3a\u6bcf\u4e2a\u5143\u7d20\u8d4b\u503c\u3002 Java\u4e2d\u4e3a\u4e8c\u7ef4\u6570\u7ec4\u9010\u4e00\u8d4b\u503c\u7684\u65b9\u6cd5 Java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5faa\u73af\u9010\u4e00\u4e3a\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u8d4b\u503c\u3002\u4ee5\u4e0b\u662f\u4e00\u79cd\u5e38\u89c1\u65b9\u6cd5\uff1a \u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u5e76\u521d\u59cb\u5316 int[][] array = new int[rows][columns]; \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff0crows \u548c columns \u5206\u522b\u8868\u793a\u4e8c\u7ef4\u6570\u7ec4\u7684\u884c\u6570\u548c\u5217\u6570\u3002 \u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u8d4b\u503c for (int i = 0; i &lt; array.length; i++) { for (int j = 0; j &lt; array[i].length; j++) { array[i][j] = value; } } \u767b\u5f55\u540e\u590d\u5236 \u5177\u4f53\u793a\u4f8b \u4ee5\u4e0b\u793a\u4f8b\u4e3a\u4e00\u4e2a 2 \u884c 3 \u5217\u7684\u4e8c\u7ef4\u6570\u7ec4\u8d4b\u503c\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b int[][] array = new int[2][3]; for [&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-40054","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/40054","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=40054"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/40054\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=40054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=40054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=40054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}