{"id":64471,"date":"2025-05-03T11:03:57","date_gmt":"2025-05-03T03:03:57","guid":{"rendered":"https:\/\/fwq.ai\/blog\/64471\/"},"modified":"2025-05-03T11:03:57","modified_gmt":"2025-05-03T03:03:57","slug":"java-%e5%87%bd%e6%95%b0%e4%b8%ad%e7%9a%84return%e8%af%ad%e5%8f%a5%e6%9c%89%e4%bb%80%e4%b9%88%e4%bd%9c%e7%94%a8%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/64471\/","title":{"rendered":"Java \u51fd\u6570\u4e2d\u7684return\u8bed\u53e5\u6709\u4ec0\u4e48\u4f5c\u7528\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173063288235849.jpg\" class=\"aligncenter\" title=\"Java \u51fd\u6570\u4e2d\u7684return\u8bed\u53e5\u6709\u4ec0\u4e48\u4f5c\u7528\uff1f\u63d2\u56fe\" alt=\"Java \u51fd\u6570\u4e2d\u7684return\u8bed\u53e5\u6709\u4ec0\u4e48\u4f5c\u7528\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u6c42\u6559java\u57fa\u7840\u51fd\u6570\u8fd4\u56de\u4f5c\u7528<\/strong><\/p>\n<p>\u5c0f\u660e\u5728\u5b66\u4e60java\u57fa\u7840\u65f6\uff0c\u9047\u5230\u4e86\u4e00\u4e2a\u51fd\u6570\u8c03\u7528\u95ee\u9898\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>public class Main {\n    public static void main(String[] args) {\n        int s = x(1, 2, 3);\n        System.out.println(s);\n    }\n\n    public static int x(int a, int b, int c) {\n        return a + b - c;\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c0f\u660e\u7406\u89e3\u4e86\u51fd\u6570\u4e2d\u7684\u6ce8\u91ca\uff0c\u4f46\u7591\u60d1\u7684\u662f\u4e3a\u4f55\u7a0b\u5e8f\u5728\u6267\u884c\u5230\u7b2c22\u884c\u540e\u53c8\u8fd4\u56de\u5230\u4e86\u4e0a\u9762\u3002\u4ed6\u731c\u6d4b\u53ef\u80fd\u662freturn\u8bed\u53e5\u8d77\u5230\u4e86\u4f5c\u7528\u3002<\/p>\n<p><strong>\u89e3\u7b54<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u662f\u7684\uff0c\u5c0f\u660e\u7684\u731c\u6d4b\u662f\u6b63\u786e\u7684\u3002\u5728java\u4e2d\uff0creturn\u8bed\u53e5\u4f1a\u5c06\u51fd\u6570\u6267\u884c\u7684\u7ed3\u679c\u8fd4\u56de\u7ed9\u8c03\u7528\u5b83\u7684\u4ee3\u7801\u3002\u5f53x\u51fd\u6570\u6267\u884c\u5230\u7b2c22\u884c\u65f6\uff0c\u4f1a\u5c06\u7ed3\u679c0\u8fd4\u56de\u7ed9\u4e3b\u51fd\u6570\u4e2d\u7684s\u53d8\u91cf\u3002\u4e4b\u540e\uff0c\u4e3b\u51fd\u6570\u5c06\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u8f93\u51fas\u7684\u503c\u4e3a0\u3002<\/p>\n<p>\u5728\u51fd\u6570\u8c03\u7528\u4e2d\uff0creturn\u8bed\u53e5\u81f3\u5173\u91cd\u8981\u3002\u5b83\u4f7f\u51fd\u6570\u53ef\u4ee5\u5411\u8c03\u7528\u5b83\u7684\u4ee3\u7801\u4f20\u56de\u7ed3\u679c\u3002\u5982\u679c\u6ca1\u6709return\u8bed\u53e5\uff0c\u51fd\u6570\u5c06\u65e0\u6cd5\u5411\u8c03\u7528\u5b83\u7684\u4ee3\u7801\u4f20\u56de\u4efb\u4f55\u503c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJava \u51fd\u6570\u4e2d\u7684return\u8bed\u53e5\u6709\u4ec0\u4e48\u4f5c\u7528\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>\u6c42\u6559java\u57fa\u7840\u51fd\u6570\u8fd4\u56de\u4f5c\u7528 \u5c0f\u660e\u5728\u5b66\u4e60java\u57fa\u7840\u65f6\uff0c\u9047\u5230\u4e86\u4e00\u4e2a\u51fd\u6570\u8c03\u7528\u95ee\u9898\uff0c\u5982\u4e0b\u6240\u793a\uff1a public class Main { public static void main(String[] args) { int s = x(1, 2, 3); System.out.println(s); } public static int x(int a, int b, int c) { return a + b &#8211; c; } } \u767b\u5f55\u540e\u590d\u5236 \u5c0f\u660e\u7406\u89e3\u4e86\u51fd\u6570\u4e2d\u7684\u6ce8\u91ca\uff0c\u4f46\u7591\u60d1\u7684\u662f\u4e3a\u4f55\u7a0b\u5e8f\u5728\u6267\u884c\u5230\u7b2c22\u884c\u540e\u53c8\u8fd4\u56de\u5230\u4e86\u4e0a\u9762\u3002\u4ed6\u731c\u6d4b\u53ef\u80fd\u662freturn\u8bed\u53e5\u8d77\u5230\u4e86\u4f5c\u7528\u3002 \u89e3\u7b54 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u662f\u7684\uff0c\u5c0f\u660e\u7684\u731c\u6d4b\u662f\u6b63\u786e\u7684\u3002\u5728java\u4e2d\uff0creturn\u8bed\u53e5\u4f1a\u5c06\u51fd\u6570\u6267\u884c\u7684\u7ed3\u679c\u8fd4\u56de\u7ed9\u8c03\u7528\u5b83\u7684\u4ee3\u7801\u3002\u5f53x\u51fd\u6570\u6267\u884c\u5230\u7b2c22\u884c\u65f6\uff0c\u4f1a\u5c06\u7ed3\u679c0\u8fd4\u56de\u7ed9\u4e3b\u51fd\u6570\u4e2d\u7684s\u53d8\u91cf\u3002\u4e4b\u540e\uff0c\u4e3b\u51fd\u6570\u5c06\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u8f93\u51fas\u7684\u503c\u4e3a0\u3002 \u5728\u51fd\u6570\u8c03\u7528\u4e2d\uff0creturn\u8bed\u53e5\u81f3\u5173\u91cd\u8981\u3002\u5b83\u4f7f\u51fd\u6570\u53ef\u4ee5\u5411\u8c03\u7528\u5b83\u7684\u4ee3\u7801\u4f20\u56de\u7ed3\u679c\u3002\u5982\u679c\u6ca1\u6709return\u8bed\u53e5\uff0c\u51fd\u6570\u5c06\u65e0\u6cd5\u5411\u8c03\u7528\u5b83\u7684\u4ee3\u7801\u4f20\u56de\u4efb\u4f55\u503c\u3002 \u4ee5\u4e0a\u5c31\u662fJava \u51fd\u6570\u4e2d\u7684return\u8bed\u53e5\u6709\u4ec0\u4e48\u4f5c\u7528\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-64471","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64471","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=64471"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64471\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=64471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=64471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=64471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}