{"id":35183,"date":"2024-11-26T11:35:00","date_gmt":"2024-11-26T03:35:00","guid":{"rendered":"https:\/\/fwq.ai\/blog\/35183\/"},"modified":"2024-11-26T11:35:00","modified_gmt":"2024-11-26T03:35:00","slug":"java-%e4%b8%ad%e7%9a%84%e5%80%bc%e4%bc%a0%e9%80%92%e5%92%8c%e5%bc%95%e7%94%a8%e4%bc%a0%e9%80%92%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%93%8d%e4%bd%9c%e6%9c%89%e6%97%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/35183\/","title":{"rendered":"Java \u4e2d\u7684\u503c\u4f20\u9012\u548c\u5f15\u7528\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u5b57\u7b26\u4e32\u64cd\u4f5c\u6709\u65f6\u4f1a\u4fee\u6539\u539f\u53d8\u91cf\uff0c\u6709\u65f6\u53c8\u4e0d\u4f1a\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173063412483119.jpg\" class=\"aligncenter\" title=\"Java \u4e2d\u7684\u503c\u4f20\u9012\u548c\u5f15\u7528\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u5b57\u7b26\u4e32\u64cd\u4f5c\u6709\u65f6\u4f1a\u4fee\u6539\u539f\u53d8\u91cf\uff0c\u6709\u65f6\u53c8\u4e0d\u4f1a\uff1f\u63d2\u56fe\" alt=\"Java \u4e2d\u7684\u503c\u4f20\u9012\u548c\u5f15\u7528\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u5b57\u7b26\u4e32\u64cd\u4f5c\u6709\u65f6\u4f1a\u4fee\u6539\u539f\u53d8\u91cf\uff0c\u6709\u65f6\u53c8\u4e0d\u4f1a\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u503c\u4f20\u9012\u4e0e\u5f15\u7528\u4f20\u9012\u4e2d\u7684\u56f0\u60d1<\/strong><\/p>\n<p>\u5728 java \u4e2d\uff0c\u5c06\u53d8\u91cf\u4f20\u9012\u7ed9\u65b9\u6cd5\u65f6\u4f1a\u5f15\u8d77\u503c\u4f20\u9012\u6216\u5f15\u7528\u4f20\u9012\u7684\u5dee\u5f02\u3002\u4ee5\u4e0b\u4ee3\u7801\u6bb5\u5c55\u793a\u4e86\u8fd9\u79cd\u5dee\u5f02\uff1a<\/p>\n<pre>public class API_Boolean {\n\n    public static void main(String[] args) {\n\n        \/\/ \u7b2c\u4e00\u6b21\u64cd\u4f5c\n        String str = \"aaa\";\n        String newStr = test(str);\n        System.out.println(str);     \/\/ \"aaa\"\n\n        \/\/ \u7b2c\u4e8c\u6b21\u64cd\u4f5c\n        String a = \"xxx\";\n        a = a + \"yyy\";\n        System.out.println(a);       \/\/ \"xxxyyy\"\n\n    }\n\n    public static String test(String s) {\n        s = s + \"bbb\";\n        return s;\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u7b2c\u4e00\u6b21\u64cd\u4f5c\u4e2d\uff0c\u5c06\u5b57\u7b26\u4e32\u53d8\u91cf str \u4f5c\u4e3a\u503c\u4f20\u9012\u7ed9 test \u65b9\u6cd5\u3002\u65b9\u6cd5\u4e2d\u7684\u64cd\u4f5c\u8fd4\u56de\u4e86\u4e00\u4e2a\u65b0\u5b57\u7b26\u4e32 newstr\uff0c\u4f46\u539f\u59cb\u53d8\u91cf str \u4fdd\u6301\u4e0d\u53d8\u3002\u56e0\u6b64\uff0c\u6253\u5370 str \u65f6\u4ecd\u663e\u793a\u4e3a &#8220;aaa&#8221;\u3002<\/p>\n<p>\u5728\u7b2c\u4e8c\u6b21\u64cd\u4f5c\u4e2d\uff0c\u5c06\u5b57\u7b26\u4e32\u53d8\u91cf a \u4f5c\u4e3a\u503c\u4f20\u9012\u7ed9\u5b57\u7b26\u4e32\u8fde\u63a5\u8fd0\u7b97\u7b26 &#8220;+=&#8221;\u3002\u8be5\u64cd\u4f5c\u76f4\u63a5\u4fee\u6539\u4e86 a \u7684\u503c\uff0c\u56e0\u6b64\u6253\u5370 a \u65f6\u663e\u793a\u4e3a &#8220;xxxy&#8221;\u3002<\/p>\n<p>\u8fd9\u79cd\u5dee\u5f02\u662f\u56e0\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\u5728 java \u4e2d\u662f\u4e0d\u53ef\u53d8\u7684\u3002\u8fd9\u610f\u5473\u7740\u5b57\u7b26\u4e32\u7684\u5185\u5bb9\u4e0d\u80fd\u76f4\u63a5\u4fee\u6539\uff0c\u800c\u662f\u5fc5\u987b\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u6765\u8868\u793a\u4fee\u6539\u540e\u7684\u5185\u5bb9\u3002\u5728\u7b2c\u4e00\u6b21\u64cd\u4f5c\u4e2d\uff0cs \u53ea\u662f\u539f\u59cb\u5b57\u7b26\u4e32 str \u7684\u5f15\u7528\u3002\u5f53 s \u88ab\u4fee\u6539\u65f6\uff0c\u5b83\u5b9e\u9645\u4e0a\u662f\u521b\u5efa\u4e86\u4e00\u4e2a\u6307\u5411\u65b0\u5b57\u7b26\u4e32\u7684\u5f15\u7528\uff0c\u800c str \u4fdd\u6301\u4e0d\u53d8\u3002\u5728\u7b2c\u4e8c\u6b21\u64cd\u4f5c\u4e2d\uff0c\u5b57\u7b26\u4e32\u5185\u5bb9\u76f4\u63a5\u88ab\u4fee\u6539\uff0c\u56e0\u4e3a\u5b57\u7b26\u4e32\u4e0d\u53ef\u53d8\u7684\u7279\u6027\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u7406\u89e3\u503c\u4f20\u9012\u548c\u5f15\u7528\u4f20\u9012\u7684\u6982\u5ff5\u5bf9\u4e8e\u7406\u89e3 java \u4e2d\u5bf9\u8c61\u548c\u53d8\u91cf\u7684\u884c\u4e3a\u81f3\u5173\u91cd\u8981\u3002\u5728\u5b9e\u8df5\u4e2d\uff0c\u6ce8\u610f\u53d8\u91cf\u548c\u5bf9\u8c61\u7c7b\u578b\u662f\u5426\u652f\u6301\u503c\u4f20\u9012\u6216\u5f15\u7528\u4f20\u9012\uff0c\u6709\u52a9\u4e8e\u907f\u514d\u4ee3\u7801\u4e2d\u7684\u610f\u5916\u884c\u4e3a\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJava \u4e2d\u7684\u503c\u4f20\u9012\u548c\u5f15\u7528\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u5b57\u7b26\u4e32\u64cd\u4f5c\u6709\u65f6\u4f1a\u4fee\u6539\u539f\u53d8\u91cf\uff0c\u6709\u65f6\u53c8\u4e0d\u4f1a\uff1f\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>\u503c\u4f20\u9012\u4e0e\u5f15\u7528\u4f20\u9012\u4e2d\u7684\u56f0\u60d1 \u5728 java \u4e2d\uff0c\u5c06\u53d8\u91cf\u4f20\u9012\u7ed9\u65b9\u6cd5\u65f6\u4f1a\u5f15\u8d77\u503c\u4f20\u9012\u6216\u5f15\u7528\u4f20\u9012\u7684\u5dee\u5f02\u3002\u4ee5\u4e0b\u4ee3\u7801\u6bb5\u5c55\u793a\u4e86\u8fd9\u79cd\u5dee\u5f02\uff1a public class API_Boolean { public static void main(String[] args) { \/\/ \u7b2c\u4e00\u6b21\u64cd\u4f5c String str = &#8220;aaa&#8221;; String newStr = test(str); System.out.println(str); \/\/ &#8220;aaa&#8221; \/\/ \u7b2c\u4e8c\u6b21\u64cd\u4f5c String a = &#8220;xxx&#8221;; a = a + &#8220;yyy&#8221;; System.out.println(a); \/\/ &#8220;xxxyyy&#8221; } public static String test(String s) { s = s + &#8220;bbb&#8221;; return s; [&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-35183","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35183","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=35183"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35183\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=35183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=35183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=35183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}