{"id":38293,"date":"2024-11-26T09:14:39","date_gmt":"2024-11-26T01:14:39","guid":{"rendered":"https:\/\/fwq.ai\/blog\/38293\/"},"modified":"2024-11-26T09:14:39","modified_gmt":"2024-11-26T01:14:39","slug":"java%e6%80%8e%e4%b9%88%e5%a3%b0%e6%98%8e%e5%af%b9%e8%b1%a1%e6%95%b0%e7%bb%84%e9%95%bf%e5%ba%a6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/38293\/","title":{"rendered":"java\u600e\u4e48\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u957f\u5ea6"},"content":{"rendered":"<blockquote><p>\n  \u5728 java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u6570\u7ec4\u7684\u5bb9\u91cf\u6765\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u7684\u957f\u5ea6\u3002\u4f8b\u5982\uff0c\u8981\u58f0\u660e\u4e00\u4e2a\u5bb9\u91cf\u4e3a 10 \u7684 object \u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1aobject[] myarray = new object[10];\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/14\/2024111412243550348.jpg\" class=\"aligncenter\" title=\"java\u600e\u4e48\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u957f\u5ea6\u63d2\u56fe\" alt=\"java\u600e\u4e48\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u957f\u5ea6\u63d2\u56fe\" \/><\/p>\n<p><strong>Java \u4e2d\u5982\u4f55\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u957f\u5ea6<\/strong><\/p>\n<p>\u5728 Java \u4e2d\uff0c\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u7684\u957f\u5ea6\u662f\u901a\u8fc7\u6307\u5b9a\u6570\u7ec4\u7684\u5bb9\u91cf\u6765\u5b9e\u73b0\u7684\u3002\u4ee5\u4e0b\u662f\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u65f6\u6307\u5b9a\u6570\u7ec4\u957f\u5ea6\u7684\u65b9\u6cd5\uff1a<\/p>\n<pre>\/\/ \u58f0\u660e\u4e00\u4e2a\u5bb9\u91cf\u4e3a 10 \u7684 Object \u6570\u7ec4\nObject[] myArray = new Object[10];<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u793a\u4f8b\u4e2d\u7684 new Object[10] \u8bed\u53e5\u521b\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a 10 \u7684 Object \u6570\u7ec4\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6570\u7ec4\u7684\u957f\u5ea6\u4e00\u65e6\u58f0\u660e\u5c31\u4e0d\u80fd\u6539\u53d8\u3002\u8fd9\u610f\u5473\u7740\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0cmyArray \u5c06\u59cb\u7ec8\u5305\u542b 10 \u4e2a\u5143\u7d20\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u58f0\u660e\u548c\u4f7f\u7528\u5177\u6709\u6307\u5b9a\u957f\u5ea6\u7684\u5bf9\u8c61\u6570\u7ec4\uff1a<\/p>\n<pre>\/\/ \u58f0\u660e\u4e00\u4e2a\u5bb9\u91cf\u4e3a 5 \u7684 String \u6570\u7ec4\nString[] names = new String[5];\n\n\/\/ \u8bbe\u7f6e\u6570\u7ec4\u5143\u7d20\nnames[0] = \"John\";\nnames[1] = \"Mary\";\nnames[2] = \"Bob\";\nnames[3] = \"Alice\";\nnames[4] = \"Tom\";\n\n\/\/ \u8bbf\u95ee\u6570\u7ec4\u5143\u7d20\nSystem.out.println(names[0]); \/\/ \u8f93\u51fa \"John\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u58f0\u660e\u4e86\u4e00\u4e2a\u5bb9\u91cf\u4e3a 5 \u7684 String \u6570\u7ec4\uff0c\u5e76\u4e3a\u6bcf\u4e2a\u5143\u7d20\u5206\u914d\u4e86\u503c\u3002\u7136\u540e\uff0c\u6211\u4eec\u8bbf\u95ee\u6570\u7ec4\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\u5e76\u5c06\u5176\u6253\u5370\u5230\u63a7\u5236\u53f0\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u600e\u4e48\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u957f\u5ea6\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>\u5728 java \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u6570\u7ec4\u7684\u5bb9\u91cf\u6765\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u7684\u957f\u5ea6\u3002\u4f8b\u5982\uff0c\u8981\u58f0\u660e\u4e00\u4e2a\u5bb9\u91cf\u4e3a 10 \u7684 object \u6570\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1aobject[] myarray = new object[10]; Java \u4e2d\u5982\u4f55\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u957f\u5ea6 \u5728 Java \u4e2d\uff0c\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u7684\u957f\u5ea6\u662f\u901a\u8fc7\u6307\u5b9a\u6570\u7ec4\u7684\u5bb9\u91cf\u6765\u5b9e\u73b0\u7684\u3002\u4ee5\u4e0b\u662f\u58f0\u660e\u5bf9\u8c61\u6570\u7ec4\u65f6\u6307\u5b9a\u6570\u7ec4\u957f\u5ea6\u7684\u65b9\u6cd5\uff1a \/\/ \u58f0\u660e\u4e00\u4e2a\u5bb9\u91cf\u4e3a 10 \u7684 Object \u6570\u7ec4 Object[] myArray = new Object[10]; \u767b\u5f55\u540e\u590d\u5236 \u4e0a\u9762\u793a\u4f8b\u4e2d\u7684 new Object[10] \u8bed\u53e5\u521b\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a 10 \u7684 Object \u6570\u7ec4\u3002 \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6570\u7ec4\u7684\u957f\u5ea6\u4e00\u65e6\u58f0\u660e\u5c31\u4e0d\u80fd\u6539\u53d8\u3002\u8fd9\u610f\u5473\u7740\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0cmyArray \u5c06\u59cb\u7ec8\u5305\u542b 10 \u4e2a\u5143\u7d20\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u793a\u4f8b \u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u58f0\u660e\u548c\u4f7f\u7528\u5177\u6709\u6307\u5b9a\u957f\u5ea6\u7684\u5bf9\u8c61\u6570\u7ec4\uff1a \/\/ \u58f0\u660e\u4e00\u4e2a\u5bb9\u91cf\u4e3a 5 \u7684 String \u6570\u7ec4 String[] names = new String[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-38293","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/38293","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=38293"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/38293\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=38293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=38293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=38293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}