{"id":66497,"date":"2025-05-03T08:49:42","date_gmt":"2025-05-03T00:49:42","guid":{"rendered":"https:\/\/fwq.ai\/blog\/66497\/"},"modified":"2025-05-03T08:49:42","modified_gmt":"2025-05-03T00:49:42","slug":"java%e6%80%8e%e4%b9%88%e6%8a%8a%e4%ba%8c%e7%bb%b4%e6%95%b0%e7%bb%84%e8%be%93%e5%87%ba-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/66497\/","title":{"rendered":"java\u600e\u4e48\u628a\u4e8c\u7ef4\u6570\u7ec4\u8f93\u51fa"},"content":{"rendered":"<blockquote><p>\n  \u901a\u8fc7 system.out.println() \u76f4\u63a5\u8f93\u51fa\u4e8c\u7ef4\u6570\u7ec4\uff0c\u6216\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u4ee5\u66f4\u6e05\u6670\u7684\u65b9\u5f0f\u8f93\u51fa\uff0c\u6216\u8005\u5229\u7528 arrays.tostring() \u65b9\u6cd5\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/16\/2024111605003140996.jpg\" class=\"aligncenter\" title=\"java\u600e\u4e48\u628a\u4e8c\u7ef4\u6570\u7ec4\u8f93\u51fa\u63d2\u56fe\" alt=\"java\u600e\u4e48\u628a\u4e8c\u7ef4\u6570\u7ec4\u8f93\u51fa\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5c06 Java \u4e2d\u7684\u4e8c\u7ef4\u6570\u7ec4\u8f93\u51fa<\/strong><\/p>\n<p><strong>\u76f4\u63a5\u8f93\u51fa\uff1a<\/strong><\/p>\n<p>\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 System.out.println() \u65b9\u6cd5\u3002\u5bf9\u4e8e\u4e8c\u7ef4\u6570\u7ec4\uff0c\u5b83\u5c06\u8f93\u51fa\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\uff0c\u4ee5\u9017\u53f7\u5206\u9694\u3002<\/p>\n<pre>int[][] array = {{1, 2, 3}, {4, 5, 6}};\nSystem.out.println(array);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>[[1, 2, 3], [4, 5, 6]]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\uff1a<\/strong><\/p>\n<p>\u8981\u4ee5\u66f4\u6e05\u6670\u7684\u65b9\u5f0f\u8f93\u51fa\u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u3002\u5916\u5c42\u5faa\u73af\u904d\u5386\u884c\uff0c\u5185\u5c42\u5faa\u73af\u904d\u5386\u5217\u3002<\/p>\n<pre>for (int i = 0; i &lt; array.length; i++) {\n    for (int j = 0; j &lt; array[i].length; j++) {\n        System.out.print(array[i][j] + \" \");\n    }\n    System.out.println();\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>1 2 3\n4 5 6<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f7f\u7528 Arrays.toString() \u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>Arrays.toString() \u65b9\u6cd5\u53ef\u4ee5\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002<\/p>\n<pre>int[][] array = {{1, 2, 3}, {4, 5, 6}};\nString[][] stringArray = {{\"a\", \"b\", \"c\"}, {\"d\", \"e\", \"f\"}};\n\nSystem.out.println(Arrays.toString(array));\nSystem.out.println(Arrays.toString(stringArray));<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>[[1, 2, 3], [4, 5, 6]]\n[[a, b, c], [d, e, f]]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u600e\u4e48\u628a\u4e8c\u7ef4\u6570\u7ec4\u8f93\u51fa\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>\u901a\u8fc7 system.out.println() \u76f4\u63a5\u8f93\u51fa\u4e8c\u7ef4\u6570\u7ec4\uff0c\u6216\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u4ee5\u66f4\u6e05\u6670\u7684\u65b9\u5f0f\u8f93\u51fa\uff0c\u6216\u8005\u5229\u7528 arrays.tostring() \u65b9\u6cd5\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002 \u5982\u4f55\u5c06 Java \u4e2d\u7684\u4e8c\u7ef4\u6570\u7ec4\u8f93\u51fa \u76f4\u63a5\u8f93\u51fa\uff1a \u6700\u7b80\u5355\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 System.out.println() \u65b9\u6cd5\u3002\u5bf9\u4e8e\u4e8c\u7ef4\u6570\u7ec4\uff0c\u5b83\u5c06\u8f93\u51fa\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\uff0c\u4ee5\u9017\u53f7\u5206\u9694\u3002 int[][] array = {{1, 2, 3}, {4, 5, 6}}; System.out.println(array); \u767b\u5f55\u540e\u590d\u5236 \u8f93\u51fa\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b [[1, 2, 3], [4, 5, 6]] \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528\u5d4c\u5957\u5faa\u73af\uff1a \u8981\u4ee5\u66f4\u6e05\u6670\u7684\u65b9\u5f0f\u8f93\u51fa\u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u3002\u5916\u5c42\u5faa\u73af\u904d\u5386\u884c\uff0c\u5185\u5c42\u5faa\u73af\u904d\u5386\u5217\u3002 for (int i = 0; i &lt; array.length; i++) { for (int j = 0; j &lt; array[i].length; j++) { System.out.print(array[i][j] [&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-66497","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/66497","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=66497"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/66497\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=66497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=66497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=66497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}