{"id":64479,"date":"2025-05-03T13:40:32","date_gmt":"2025-05-03T05:40:32","guid":{"rendered":"https:\/\/fwq.ai\/blog\/64479\/"},"modified":"2025-05-03T13:40:32","modified_gmt":"2025-05-03T05:40:32","slug":"java-%e4%b8%ad%e6%96%b9%e6%b3%95%e7%9a%84%e5%8f%82%e6%95%b0%e4%bc%a0%e9%80%92%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88%e5%90%8c%e4%b8%80%e4%b8%aa%e6%93%8d%e4%bd%9c%e4%bc%9a%e4%ba%a7%e7%94%9f%e4%b8%8d-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/64479\/","title":{"rendered":"Java \u4e2d\u65b9\u6cd5\u7684\u53c2\u6570\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u540c\u4e00\u4e2a\u64cd\u4f5c\u4f1a\u4ea7\u751f\u4e0d\u540c\u7684\u7ed3\u679c\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173063564666267.jpg\" class=\"aligncenter\" title=\"Java \u4e2d\u65b9\u6cd5\u7684\u53c2\u6570\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u540c\u4e00\u4e2a\u64cd\u4f5c\u4f1a\u4ea7\u751f\u4e0d\u540c\u7684\u7ed3\u679c\uff1f\u63d2\u56fe\" alt=\"Java \u4e2d\u65b9\u6cd5\u7684\u53c2\u6570\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u540c\u4e00\u4e2a\u64cd\u4f5c\u4f1a\u4ea7\u751f\u4e0d\u540c\u7684\u7ed3\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728\u65b9\u6cd5\u4e2d\u6267\u884c\u540c\u4e00\u64cd\u4f5c\u5374\u5f97\u5230\u4e0d\u540c\u8f93\u51fa\u7ed3\u679c\uff1f<\/strong><\/p>\n<p>\u5728 java \u4e2d\uff0c\u5f53\u5c06\u5bf9\u8c61\u4f20\u9012\u5230\u65b9\u6cd5\u65f6\uff0c\u4f1a\u4f20\u9012\u5bf9\u8c61\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u5bf9\u8c61\u672c\u8eab\u7684\u503c\u3002\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u610f\u6599\u4e4b\u5916\u7684\u884c\u4e3a\uff0c\u5982\u4e0b\u4f8b\u6240\u793a\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);     \/\/ \u8f93\u51fa \"aaa\"\n\n        \/\/ \u7b2c\u4e8c\u6b21\u64cd\u4f5c\n        String a = \"xxx\";\n        a = a + \"yyy\";\n        System.out.println(a);       \/\/ \u8f93\u51fa \"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\uff0cstr \u53d8\u91cf\u5b58\u50a8\u4e00\u4e2a\u6307\u5411\u5b57\u7b26\u4e32 &#8220;aaa&#8221; \u7684\u5185\u5b58\u5730\u5740\u3002\u5f53\u6211\u4eec\u8c03\u7528 test \u65b9\u6cd5\u65f6\uff0c\u6211\u4eec\u4f20\u9012\u7684\u4e0d\u662f\u5b57\u7b26\u4e32\u672c\u8eab\uff0c\u800c\u662f\u6307\u5411\u8be5\u5b57\u7b26\u4e32\u7684\u5f15\u7528\u3002\u65b9\u6cd5\u4e2d\u66f4\u6539 s \u7684\u503c\u4f1a\u5f71\u54cd newstr\uff0c\u4f46\u4e0d\u4f1a\u5f71\u54cd str\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5728\u7b2c\u4e8c\u6b21\u64cd\u4f5c\u4e2d\uff0ca \u76f4\u63a5\u5b58\u50a8\u5b57\u7b26\u4e32 &#8220;xxx&#8221;\uff0c\u800c\u4e0d\u662f\u5f15\u7528\u3002\u5f53\u6211\u4eec\u5bf9 a \u8fdb\u884c\u52a0\u6cd5\u64cd\u4f5c\u65f6\uff0cjava \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u5bf9\u8c61 &#8220;xxxy&#8221;\uff0c\u5e76\u5c06\u5176\u8d4b\u503c\u7ed9 a\u3002\u56e0\u6b64\uff0ca \u7684\u503c\u53d1\u751f\u4e86\u6539\u53d8\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u79cd\u60c5\u51b5\u53ea\u9002\u7528\u4e8e\u5bf9\u8c61\u7c7b\u578b\uff0c\u4f8b\u5982\u5b57\u7b26\u4e32\u3002\u5bf9\u4e8e\u57fa\u672c\u7c7b\u578b\uff08\u4f8b\u5982 int\u3001double\uff09\uff0c\u4f20\u9012\u7684\u662f\u503c\u672c\u8eab\uff0c\u800c\u4e0d\u662f\u5f15\u7528\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJava \u4e2d\u65b9\u6cd5\u7684\u53c2\u6570\u4f20\u9012\uff1a\u4e3a\u4ec0\u4e48\u540c\u4e00\u4e2a\u64cd\u4f5c\u4f1a\u4ea7\u751f\u4e0d\u540c\u7684\u7ed3\u679c\uff1f\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>\u5982\u4f55\u5728\u65b9\u6cd5\u4e2d\u6267\u884c\u540c\u4e00\u64cd\u4f5c\u5374\u5f97\u5230\u4e0d\u540c\u8f93\u51fa\u7ed3\u679c\uff1f \u5728 java \u4e2d\uff0c\u5f53\u5c06\u5bf9\u8c61\u4f20\u9012\u5230\u65b9\u6cd5\u65f6\uff0c\u4f1a\u4f20\u9012\u5bf9\u8c61\u7684\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u5bf9\u8c61\u672c\u8eab\u7684\u503c\u3002\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u610f\u6599\u4e4b\u5916\u7684\u884c\u4e3a\uff0c\u5982\u4e0b\u4f8b\u6240\u793a\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); \/\/ \u8f93\u51fa &#8220;aaa&#8221; \/\/ \u7b2c\u4e8c\u6b21\u64cd\u4f5c String a = &#8220;xxx&#8221;; a = a + &#8220;yyy&#8221;; System.out.println(a); \/\/ \u8f93\u51fa &#8220;xxxyyy&#8221; } public static String test(String s) { s = s + &#8220;bbb&#8221;; [&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-64479","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64479","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=64479"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64479\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=64479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=64479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=64479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}