{"id":39182,"date":"2024-11-26T10:25:33","date_gmt":"2024-11-26T02:25:33","guid":{"rendered":"https:\/\/fwq.ai\/blog\/39182\/"},"modified":"2024-11-26T10:25:33","modified_gmt":"2024-11-26T02:25:33","slug":"java%e4%ba%8c%e7%bb%b4%e6%95%b0%e7%bb%84%e6%80%8e%e4%b9%88%e8%b5%8b%e5%88%9d%e5%80%bc","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/39182\/","title":{"rendered":"java\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u8d4b\u521d\u503c"},"content":{"rendered":"<blockquote><p>\n  \u4e3a java \u4e8c\u7ef4\u6570\u7ec4\u8d4b\u521d\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e24\u79cd\u65b9\u6cd5\uff1a\u5d4c\u5957\u5faa\u73af\uff1a\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u904d\u5386\u6570\u7ec4\uff0c\u9010\u4e2a\u5143\u7d20\u8d4b\u503c\u3002\u6570\u7ec4\u8bed\u6cd5\uff1a\u4f7f\u7528\u5927\u62ec\u53f7 {} \u62ec\u8d77\uff0c\u9017\u53f7\u5206\u9694\u6bcf\u884c\u7684\u5143\u7d20\u503c\uff0c\u5185\u5c42\u5927\u62ec\u53f7\u5206\u7ec4\u6bcf\u4e00\u884c\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/16\/2024111604542136352.jpg\" class=\"aligncenter\" title=\"java\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u8d4b\u521d\u503c\u63d2\u56fe\" alt=\"java\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u8d4b\u521d\u503c\u63d2\u56fe\" \/><\/p>\n<p><strong>Java \u4e8c\u7ef4\u6570\u7ec4\u521d\u59cb\u5316<\/strong><\/p>\n<p><strong>\u5982\u4f55\u4e3a Java \u4e8c\u7ef4\u6570\u7ec4\u8d4b\u521d\u503c\uff1f<\/strong><\/p>\n<p>\u8981\u4e3a Java \u4e8c\u7ef4\u6570\u7ec4\u8d4b\u521d\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p><strong>\u65b9\u6cd5 1\uff1a\u4f7f\u7528\u5d4c\u5957\u5faa\u73af<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u4f7f\u7528\u4e24\u4e2a\u5d4c\u5957\u5faa\u73af\u904d\u5386\u6570\u7ec4\uff0c\u5e76\u5728\u6bcf\u4e2a\u5143\u7d20\u4e2d\u8bbe\u7f6e\u503c\u3002<\/p>\n<pre>int[][] arr = new int[3][3];\n\nfor (int i = 0; i &lt; arr.length; i++) {\n    for (int j = 0; j &lt; arr[i].length; j++) {\n        arr[i][j] = i * j;\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u65b9\u6cd5 2\uff1a\u4f7f\u7528\u6570\u7ec4\u8bed\u6cd5<\/strong><\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u4f7f\u7528\u6570\u7ec4\u8bed\u6cd5\u76f4\u63a5\u4e3a\u6570\u7ec4\u5143\u7d20\u8d4b\u503c\u3002<\/p>\n<pre>int[][] arr = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8be6\u7ec6\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u65b9\u6cd5 1\uff1a<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a\u4e8c\u7ef4\u6570\u7ec4\uff0c\u6bcf\u4e2a\u5143\u7d20\u90fd\u521d\u59cb\u5316\u4e3a 0\u3002<\/li>\n<li>\u4f7f\u7528\u4e24\u4e2a for \u5faa\u73af\u6765\u904d\u5386\u6570\u7ec4\u7684\u6bcf\u4e00\u884c\u548c\u6bcf\u4e00\u5217\u3002<\/li>\n<li>\u5728\u6bcf\u4e2a\u5143\u7d20\u4e2d\u8bbe\u7f6e\u503c\uff0c\u4f8b\u5982 i * j \u8fd9\u6837\u7684\u8868\u8fbe\u5f0f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u65b9\u6cd5 2\uff1a<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a\u4e8c\u7ef4\u6570\u7ec4\uff0c\u4f7f\u7528\u5927\u62ec\u53f7 {} \u62ec\u8d77\u3002<\/li>\n<li>\u4f7f\u7528\u9017\u53f7\u5206\u9694\u6bcf\u4e00\u884c\u7684\u5143\u7d20\u503c\u3002<\/li>\n<li>\u4f7f\u7528\u5185\u5c42\u5927\u62ec\u53f7\u5c06\u6bcf\u4e00\u884c\u7684\u503c\u5206\u7ec4\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u5f53\u4f7f\u7528\u6570\u7ec4\u8bed\u6cd5\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\u65f6\uff0c\u91cd\u8981\u7684\u662f\u786e\u4fdd\u6bcf\u884c\u7684\u5143\u7d20\u6570\u91cf\u76f8\u7b49\u3002<\/li>\n<li>\u5982\u679c\u6570\u7ec4\u4e2d\u7684\u4efb\u4f55\u5143\u7d20\u6ca1\u6709\u660e\u786e\u521d\u59cb\u5316\uff0c\u5219\u4f1a\u88ab\u81ea\u52a8\u521d\u59cb\u5316\u4e3a 0\uff08\u5bf9\u4e8e int \u6570\u7ec4\uff09\u6216 null\uff08\u5bf9\u4e8e\u5f15\u7528\u7c7b\u578b\u6570\u7ec4\uff09\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u4e8c\u7ef4\u6570\u7ec4\u600e\u4e48\u8d4b\u521d\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>\u4e3a java \u4e8c\u7ef4\u6570\u7ec4\u8d4b\u521d\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e24\u79cd\u65b9\u6cd5\uff1a\u5d4c\u5957\u5faa\u73af\uff1a\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u904d\u5386\u6570\u7ec4\uff0c\u9010\u4e2a\u5143\u7d20\u8d4b\u503c\u3002\u6570\u7ec4\u8bed\u6cd5\uff1a\u4f7f\u7528\u5927\u62ec\u53f7 {} \u62ec\u8d77\uff0c\u9017\u53f7\u5206\u9694\u6bcf\u884c\u7684\u5143\u7d20\u503c\uff0c\u5185\u5c42\u5927\u62ec\u53f7\u5206\u7ec4\u6bcf\u4e00\u884c\u3002 Java \u4e8c\u7ef4\u6570\u7ec4\u521d\u59cb\u5316 \u5982\u4f55\u4e3a Java \u4e8c\u7ef4\u6570\u7ec4\u8d4b\u521d\u503c\uff1f \u8981\u4e3a Java \u4e8c\u7ef4\u6570\u7ec4\u8d4b\u521d\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6cd5\uff1a \u65b9\u6cd5 1\uff1a\u4f7f\u7528\u5d4c\u5957\u5faa\u73af \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u8fd9\u79cd\u65b9\u6cd5\u4f7f\u7528\u4e24\u4e2a\u5d4c\u5957\u5faa\u73af\u904d\u5386\u6570\u7ec4\uff0c\u5e76\u5728\u6bcf\u4e2a\u5143\u7d20\u4e2d\u8bbe\u7f6e\u503c\u3002 int[][] arr = new int[3][3]; for (int i = 0; i &lt; arr.length; i++) { for (int j = 0; j &lt; arr[i].length; j++) { arr[i][j] = i * j; } } \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5 2\uff1a\u4f7f\u7528\u6570\u7ec4\u8bed\u6cd5 \u8fd9\u79cd\u65b9\u6cd5\u4f7f\u7528\u6570\u7ec4\u8bed\u6cd5\u76f4\u63a5\u4e3a\u6570\u7ec4\u5143\u7d20\u8d4b\u503c\u3002 int[][] arr [&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-39182","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39182","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=39182"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39182\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=39182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=39182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=39182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}