{"id":37548,"date":"2024-11-26T11:01:06","date_gmt":"2024-11-26T03:01:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/37548\/"},"modified":"2024-11-26T11:01:06","modified_gmt":"2024-11-26T03:01:06","slug":"java%e5%af%b9%e8%b1%a1%e7%b1%bb%e5%9e%8b%e6%95%b0%e7%bb%84%e6%80%8e%e4%b9%88%e8%b5%8b%e5%80%bc","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/37548\/","title":{"rendered":"java\u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u600e\u4e48\u8d4b\u503c"},"content":{"rendered":"<blockquote><p>\n  \u4e3a java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u8d4b\u503c\u9700\u8981\uff1a\u4f7f\u7528 new \u5173\u952e\u5b57\u521b\u5efa\u6570\u7ec4\u5bf9\u8c61\u9010\u4e2a\u4e3a\u6570\u7ec4\u5143\u7d20\u8d4b\u503c\uff0c\u53ef\u901a\u8fc7\u6570\u7ec4\u4e0b\u6807\u8bbf\u95ee\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/13\/2024111307063665466.jpg\" class=\"aligncenter\" title=\"java\u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u600e\u4e48\u8d4b\u503c\u63d2\u56fe\" alt=\"java\u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u600e\u4e48\u8d4b\u503c\u63d2\u56fe\" \/><\/p>\n<p><strong>Java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u7684\u8d4b\u503c<\/strong><\/p>\n<p><strong>\u5982\u4f55\u4e3a Java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u8d4b\u503c\uff1f<\/strong><\/p>\n<p>\u4e3a Java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u8d4b\u503c\u9700\u8981\u4f7f\u7528 new \u5173\u952e\u5b57\u521b\u5efa\u6570\u7ec4\u5bf9\u8c61\uff0c\u7136\u540e\u9010\u4e2a\u4e3a\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u8d4b\u503c\u3002\u8d4b\u503c\u64cd\u4f5c\u53ef\u901a\u8fc7\u6570\u7ec4\u4e0b\u6807\u8fdb\u884c\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<ol>\n<li> <strong>\u521b\u5efa\u6570\u7ec4\u5bf9\u8c61\uff1a<\/strong>\u4f7f\u7528 new \u5173\u952e\u5b57\u6307\u5b9a\u6570\u7ec4\u7c7b\u578b\u548c\u5927\u5c0f\uff0c\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre>Object[] arr = new Object[5];<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li> <strong>\u9010\u4e2a\u8d4b\u503c\uff1a<\/strong>\u4f7f\u7528\u6570\u7ec4\u4e0b\u6807\u8bbf\u95ee\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\uff0c\u5e76\u4e3a\u5176\u8d4b\u503c\uff0c\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre>arr[0] = \"String\";\narr[1] = 100;\narr[2] = new Integer(200);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b\u4ee3\u7801\uff1a<\/strong><\/p>\n<pre>Object[] arr = new Object[3];\narr[0] = \"Hello\";\narr[1] = 100;\narr[2] = new Integer(200);\n\nSystem.out.println(arr[0]); \/\/ \u8f93\u51fa: Hello\nSystem.out.println(arr[1]); \/\/ \u8f93\u51fa: 100\nSystem.out.println(arr[2]); \/\/ \u8f93\u51fa: 200<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>\u6570\u7ec4\u7684\u5927\u5c0f\u5fc5\u987b\u9884\u5148\u786e\u5b9a\u3002<\/li>\n<li>\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u53ef\u4ee5\u662f\u4e0d\u540c\u7c7b\u578b\u7684\u5bf9\u8c61\u3002<\/li>\n<li>\u6570\u7ec4\u4e0b\u6807\u4ece 0 \u5f00\u59cb\u3002<\/li>\n<li>\u6570\u7ec4\u5143\u7d20\u53ef\u4ee5\u88ab\u91cd\u65b0\u8d4b\u503c\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u600e\u4e48\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>\u4e3a java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u8d4b\u503c\u9700\u8981\uff1a\u4f7f\u7528 new \u5173\u952e\u5b57\u521b\u5efa\u6570\u7ec4\u5bf9\u8c61\u9010\u4e2a\u4e3a\u6570\u7ec4\u5143\u7d20\u8d4b\u503c\uff0c\u53ef\u901a\u8fc7\u6570\u7ec4\u4e0b\u6807\u8bbf\u95ee Java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u7684\u8d4b\u503c \u5982\u4f55\u4e3a Java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u8d4b\u503c\uff1f \u4e3a Java \u5bf9\u8c61\u7c7b\u578b\u6570\u7ec4\u8d4b\u503c\u9700\u8981\u4f7f\u7528 new \u5173\u952e\u5b57\u521b\u5efa\u6570\u7ec4\u5bf9\u8c61\uff0c\u7136\u540e\u9010\u4e2a\u4e3a\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u8d4b\u503c\u3002\u8d4b\u503c\u64cd\u4f5c\u53ef\u901a\u8fc7\u6570\u7ec4\u4e0b\u6807\u8fdb\u884c\u3002 \u8be6\u7ec6\u6b65\u9aa4\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u521b\u5efa\u6570\u7ec4\u5bf9\u8c61\uff1a\u4f7f\u7528 new \u5173\u952e\u5b57\u6307\u5b9a\u6570\u7ec4\u7c7b\u578b\u548c\u5927\u5c0f\uff0c\u4f8b\u5982\uff1a Object[] arr = new Object[5]; \u767b\u5f55\u540e\u590d\u5236 \u9010\u4e2a\u8d4b\u503c\uff1a\u4f7f\u7528\u6570\u7ec4\u4e0b\u6807\u8bbf\u95ee\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\uff0c\u5e76\u4e3a\u5176\u8d4b\u503c\uff0c\u4f8b\u5982\uff1a arr[0] = &#8220;String&#8221;; arr[1] = 100; arr[2] = new Integer(200); \u767b\u5f55\u540e\u590d\u5236 \u793a\u4f8b\u4ee3\u7801\uff1a Object[] arr = new Object[3]; arr[0] = &#8220;Hello&#8221;; arr[1] = 100; arr[2] = new Integer(200); System.out.println(arr[0]); [&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-37548","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/37548","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=37548"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/37548\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=37548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=37548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=37548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}