{"id":39190,"date":"2024-11-26T14:18:54","date_gmt":"2024-11-26T06:18:54","guid":{"rendered":"https:\/\/fwq.ai\/blog\/39190\/"},"modified":"2024-11-26T14:18:54","modified_gmt":"2024-11-26T06:18:54","slug":"java%e4%b8%ad%e6%80%8e%e4%b9%88%e5%a3%b0%e6%98%8e%e4%ba%8c%e7%bb%b4%e6%95%b0%e7%bb%84","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/39190\/","title":{"rendered":"java\u4e2d\u600e\u4e48\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4"},"content":{"rendered":"<blockquote><p>\n  java \u4e2d\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u53ef\u76f4\u63a5\u521d\u59cb\u5316\u6216\u90e8\u5206\u521d\u59cb\u5316\u3002\u76f4\u63a5\u521d\u59cb\u5316\uff1a\u58f0\u660e\u4e00\u4e2a\u65b0\u4e8c\u7ef4\u6570\u7ec4\u5e76\u4f7f\u7528\u5d4c\u5957\u5927\u62ec\u53f7\u4e00\u6b21\u6027\u521d\u59cb\u5316\u6240\u6709\u5143\u7d20\u3002\u90e8\u5206\u521d\u59cb\u5316\uff1a\u58f0\u660e\u4e00\u4e2a\u65b0\u4e8c\u7ef4\u6570\u7ec4\uff0c\u53ea\u521d\u59cb\u5316\u90e8\u5206\u884c\uff0c\u7136\u540e\u901a\u8fc7\u5f15\u7528\u884c\u6765\u521d\u59cb\u5316\u5269\u4f59\u884c\u3002\u904d\u5386\u4e8c\u7ef4\u6570\u7ec4\u65f6\uff0c\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u8bbf\u95ee\u884c\u548c\u5143\u7d20\u3002\u6570\u7ec4\u5143\u7d20\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u884c\u548c\u5217\u7d22\u5f15\u6765\u8bbf\u95ee\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/16\/2024111604574983692.jpg\" class=\"aligncenter\" title=\"java\u4e2d\u600e\u4e48\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u63d2\u56fe\" alt=\"java\u4e2d\u600e\u4e48\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Java \u4e2d\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4<\/strong><\/p>\n<p><strong>\u76f4\u63a5\u521d\u59cb\u5316<\/strong><\/p>\n<pre>\/\/ \u58f0\u660e\u5e76\u521d\u59cb\u5316\u4e00\u4e2a 2x3 \u7684\u4e8c\u7ef4\u6570\u7ec4\nint[][] arr = new int[][]{{1, 2, 3}, {4, 5, 6}};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u90e8\u5206\u521d\u59cb\u5316<\/strong><\/p>\n<pre>\/\/ \u58f0\u660e\u4e00\u4e2a 3x3 \u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u53ea\u521d\u59cb\u5316\u7b2c\u4e00\u884c\nint[][] arr = new int[3][3];\narr[0] = new int[]{1, 2, 3};\n\n\/\/ \u4e4b\u540e\u518d\u521d\u59cb\u5316\u5176\u4ed6\u884c\narr[1] = new int[]{4, 5, 6};\narr[2] = new int[]{7, 8, 9};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u904d\u5386\u6570\u7ec4<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>\/\/ \u904d\u5386\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u6240\u6709\u5143\u7d20\nfor (int[] row : arr) {\n    for (int element : row) {\n        System.out.print(element + \" \");\n    }\n    System.out.println();\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6570\u7ec4\u5143\u7d20\u8bbf\u95ee<\/strong><\/p>\n<pre>\/\/ \u8bbf\u95ee\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7279\u5b9a\u4f4d\u7f6e\u7684\u5143\u7d20\nSystem.out.println(arr[1][2]); \/\/ \u8f93\u51fa 6<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8865\u5145\u8bf4\u660e<\/strong><\/p>\n<ul>\n<li>\u4e8c\u7ef4\u6570\u7ec4\u7684\u7b2c\u4e00\u4e2a\u7ef4\u5ea6\u8868\u793a\u884c\u6570\uff0c\u7b2c\u4e8c\u4e2a\u7ef4\u5ea6\u8868\u793a\u5217\u6570\u3002<\/li>\n<li>\u6bcf\u4e2a\u4e00\u7ef4\u6570\u7ec4\u79f0\u4e3a\u4e00\u7ef4\u6570\u7ec4\u6216\u884c\u3002<\/li>\n<li>\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u4e00\u4e2a\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u503c\uff08\u4f8b\u5982 int\u3001double\u3001char\uff09\u3002<\/li>\n<li>\u4e00\u65e6\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\uff0c\u5176\u884c\u6570\u548c\u5217\u6570\u5c31\u4e0d\u53ef\u6539\u53d8\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u4e2d\u600e\u4e48\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\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>java \u4e2d\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4\u53ef\u76f4\u63a5\u521d\u59cb\u5316\u6216\u90e8\u5206\u521d\u59cb\u5316\u3002\u76f4\u63a5\u521d\u59cb\u5316\uff1a\u58f0\u660e\u4e00\u4e2a\u65b0\u4e8c\u7ef4\u6570\u7ec4\u5e76\u4f7f\u7528\u5d4c\u5957\u5927\u62ec\u53f7\u4e00\u6b21\u6027\u521d\u59cb\u5316\u6240\u6709\u5143\u7d20\u3002\u90e8\u5206\u521d\u59cb\u5316\uff1a\u58f0\u660e\u4e00\u4e2a\u65b0\u4e8c\u7ef4\u6570\u7ec4\uff0c\u53ea\u521d\u59cb\u5316\u90e8\u5206\u884c\uff0c\u7136\u540e\u901a\u8fc7\u5f15\u7528\u884c\u6765\u521d\u59cb\u5316\u5269\u4f59\u884c\u3002\u904d\u5386\u4e8c\u7ef4\u6570\u7ec4\u65f6\uff0c\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u8bbf\u95ee\u884c\u548c\u5143\u7d20\u3002\u6570\u7ec4\u5143\u7d20\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u884c\u548c\u5217\u7d22\u5f15\u6765\u8bbf\u95ee\u3002 \u5982\u4f55\u5728 Java \u4e2d\u58f0\u660e\u4e8c\u7ef4\u6570\u7ec4 \u76f4\u63a5\u521d\u59cb\u5316 \/\/ \u58f0\u660e\u5e76\u521d\u59cb\u5316\u4e00\u4e2a 2&#215;3 \u7684\u4e8c\u7ef4\u6570\u7ec4 int[][] arr = new int[][]{{1, 2, 3}, {4, 5, 6}}; \u767b\u5f55\u540e\u590d\u5236 \u90e8\u5206\u521d\u59cb\u5316 \/\/ \u58f0\u660e\u4e00\u4e2a 3&#215;3 \u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u53ea\u521d\u59cb\u5316\u7b2c\u4e00\u884c int[][] arr = new int[3][3]; arr[0] = new int[]{1, 2, 3}; \/\/ \u4e4b\u540e\u518d\u521d\u59cb\u5316\u5176\u4ed6\u884c arr[1] = new int[]{4, 5, 6}; arr[2] = new int[]{7, 8, 9}; \u767b\u5f55\u540e\u590d\u5236 \u904d\u5386\u6570\u7ec4 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \/\/ [&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-39190","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39190","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=39190"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39190\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=39190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=39190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=39190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}