{"id":64567,"date":"2025-05-03T15:37:02","date_gmt":"2025-05-03T07:37:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/64567\/"},"modified":"2025-05-03T15:37:02","modified_gmt":"2025-05-03T07:37:02","slug":"java%e6%80%8e%e4%b9%88%e7%bb%99%e6%95%b0%e7%bb%84%e4%b8%ad%e4%bc%a0%e5%ad%97%e7%ac%a6%e4%b8%b2-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/64567\/","title":{"rendered":"java\u600e\u4e48\u7ed9\u6570\u7ec4\u4e2d\u4f20\u5b57\u7b26\u4e32"},"content":{"rendered":"<blockquote><p>\n  java \u4e2d\u5411\u6570\u7ec4\u4f20\u9012\u5b57\u7b26\u4e32\u7684\u4e24\u79cd\u65b9\u6cd5\uff1a1. \u4f7f\u7528\u6587\u5b57\u521d\u59cb\u5316\uff08\u4f8b\u5982\uff1astring[] names = {&#8220;john&#8221;, &#8220;mary&#8221;, &#8220;bob&#8221;}\uff09\u30022. \u4f7f\u7528\u5b57\u7b26\u4e32\u53d8\u91cf\u521d\u59cb\u5316\uff08\u4f8b\u5982\uff1astring[] names = {name1, name2, name3}\uff09\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/04\/2024110401511585070.jpg\" class=\"aligncenter\" title=\"java\u600e\u4e48\u7ed9\u6570\u7ec4\u4e2d\u4f20\u5b57\u7b26\u4e32\u63d2\u56fe\" alt=\"java\u600e\u4e48\u7ed9\u6570\u7ec4\u4e2d\u4f20\u5b57\u7b26\u4e32\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Java \u4e2d\u5411\u6570\u7ec4\u4f20\u9012\u5b57\u7b26\u4e32<\/strong><\/p>\n<p><strong>\u7b54\u6848\uff1a<\/strong><br \/>\u4f7f\u7528 String \u7c7b\u578b\u7684\u6570\u7ec4\u5e76\u4f7f\u7528\u6587\u5b57\u6216\u5b57\u7b26\u4e32\u53d8\u91cf\u5bf9\u5176\u8fdb\u884c\u521d\u59cb\u5316\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u8bf4\u660e\uff1a<\/strong><\/p>\n<p>\u5728 Java \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 String \u7c7b\u578b\u7684\u6570\u7ec4\u6765\u5b58\u50a8\u5b57\u7b26\u4e32\u3002\u53ef\u4ee5\u4f7f\u7528\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\u5411\u6570\u7ec4\u4e2d\u4f20\u9012\u5b57\u7b26\u4e32\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528\u6587\u5b57\u521d\u59cb\u5316\uff1a<\/strong><\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>String[] names = {\"John\", \"Mary\", \"Bob\"};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u4f7f\u7528\u5b57\u7b26\u4e32\u53d8\u91cf\u521d\u59cb\u5316\uff1a<\/strong><\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>String name1 = \"John\";\nString name2 = \"Mary\";\nString name3 = \"Bob\";\nString[] names = {name1, name2, name3};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ol>\n<p>\u4e00\u65e6\u521d\u59cb\u5316\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u6570\u7ec4\u7d22\u5f15\u6765\u8bbf\u95ee\u6570\u7ec4\u4e2d\u7684\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>System.out.println(names[0]); \/\/ \u6253\u5370\u6570\u7ec4\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u600e\u4e48\u7ed9\u6570\u7ec4\u4e2d\u4f20\u5b57\u7b26\u4e32\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>java \u4e2d\u5411\u6570\u7ec4\u4f20\u9012\u5b57\u7b26\u4e32\u7684\u4e24\u79cd\u65b9\u6cd5\uff1a1. \u4f7f\u7528\u6587\u5b57\u521d\u59cb\u5316\uff08\u4f8b\u5982\uff1astring[] names = {&#8220;john&#8221;, &#8220;mary&#8221;, &#8220;bob&#8221;}\uff09\u30022. \u4f7f\u7528\u5b57\u7b26\u4e32\u53d8\u91cf\u521d\u59cb\u5316\uff08\u4f8b\u5982\uff1astring[] names = {name1, name2, name3}\uff09\u3002 \u5982\u4f55\u5728 Java \u4e2d\u5411\u6570\u7ec4\u4f20\u9012\u5b57\u7b26\u4e32 \u7b54\u6848\uff1a\u4f7f\u7528 String \u7c7b\u578b\u7684\u6570\u7ec4\u5e76\u4f7f\u7528\u6587\u5b57\u6216\u5b57\u7b26\u4e32\u53d8\u91cf\u5bf9\u5176\u8fdb\u884c\u521d\u59cb\u5316\u3002 \u8be6\u7ec6\u8bf4\u660e\uff1a \u5728 Java \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 String \u7c7b\u578b\u7684\u6570\u7ec4\u6765\u5b58\u50a8\u5b57\u7b26\u4e32\u3002\u53ef\u4ee5\u4f7f\u7528\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\u5411\u6570\u7ec4\u4e2d\u4f20\u9012\u5b57\u7b26\u4e32\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4f7f\u7528\u6587\u5b57\u521d\u59cb\u5316\uff1a \u4f8b\u5982\uff1a String[] names = {&#8220;John&#8221;, &#8220;Mary&#8221;, &#8220;Bob&#8221;}; \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528\u5b57\u7b26\u4e32\u53d8\u91cf\u521d\u59cb\u5316\uff1a \u4f8b\u5982\uff1a String name1 = &#8220;John&#8221;; String name2 = &#8220;Mary&#8221;; String name3 = &#8220;Bob&#8221;; String[] names = {name1, name2, [&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-64567","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64567","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=64567"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64567\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=64567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=64567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=64567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}