{"id":36140,"date":"2024-11-26T08:06:21","date_gmt":"2024-11-26T00:06:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/36140\/"},"modified":"2024-11-26T08:06:21","modified_gmt":"2024-11-26T00:06:21","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8java%e4%b8%ad%e5%b0%86%e5%80%bc%e4%bb%8e%e4%b8%80%e4%b8%aa%e7%b1%bb%e4%bc%a0%e9%80%92%e5%88%b0%e5%8f%a6%e4%b8%80%e4%b8%aa%e7%b1%bb%ef%bc%8c%e8%80%8c%e4%b8%8d%e9%87%8d","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/36140\/","title":{"rendered":"\u5982\u4f55\u5728Java\u4e2d\u5c06\u503c\u4ece\u4e00\u4e2a\u7c7b\u4f20\u9012\u5230\u53e6\u4e00\u4e2a\u7c7b\uff0c\u800c\u4e0d\u91cd\u65b0\u5b9e\u4f8b\u5316\u4e3b\u7c7b\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173097343390918.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5728Java\u4e2d\u5c06\u503c\u4ece\u4e00\u4e2a\u7c7b\u4f20\u9012\u5230\u53e6\u4e00\u4e2a\u7c7b\uff0c\u800c\u4e0d\u91cd\u65b0\u5b9e\u4f8b\u5316\u4e3b\u7c7b\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5728Java\u4e2d\u5c06\u503c\u4ece\u4e00\u4e2a\u7c7b\u4f20\u9012\u5230\u53e6\u4e00\u4e2a\u7c7b\uff0c\u800c\u4e0d\u91cd\u65b0\u5b9e\u4f8b\u5316\u4e3b\u7c7b\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5c06\u503c\u4ece\u4e00\u4e2a\u7c7b\u4f20\u9012\u5230\u53e6\u4e00\u4e2a\u7c7b\u7684\u65b9\u6cd5<\/strong><\/p>\n<p>\u5728java\u4e2d\uff0c\u5f53\u9700\u8981\u5728\u4e0d\u540c\u7684\u7c7b\u4e4b\u95f4\u4f20\u9012\u503c\u65f6\uff0c\u6709\u51e0\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5b9e\u73b0\u3002\u5176\u4e2d\u4e00\u4e2a\u5e38\u89c1\u7684\u6311\u6218\u662f\u5728\u4e0d\u91cd\u65b0\u5b9e\u4f8b\u5316\u4e3b\u7c7b\u7684\u60c5\u51b5\u4e0b\uff0c\u5c06\u503c\u4f20\u9012\u56de\u4e3b\u7c7b\u3002<\/p>\n<p>\u4e00\u79cd\u6709\u6548\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<strong>\u8fd4\u56de\u65b9\u6cd5<\/strong>\u3002\u88ab\u8c03\u7528\u7684\u7c7b\uff08\u5373a\u7c7b\uff09\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u8fd4\u56de\u65b9\u6cd5\u6765\u8fd4\u56de\u6240\u9700\u7684 index \u503c\u3002\u7136\u540e\uff0c\u4e3b\u7c7b\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u8be5\u65b9\u6cd5\u6765\u68c0\u7d22 index \u503c\u3002<\/p>\n<p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f<strong>\u4f7f\u7528\u56de\u8c03\u51fd\u6570<\/strong>\u3002\u56de\u8c03\u51fd\u6570\u662f\u4e00\u4e2a\u4f20\u9012\u7ed9\u53e6\u4e00\u4e2a\u7c7b\u7684\u51fd\u6570\u6307\u9488\u3002\u5f53\u64cd\u4f5c\u5b8c\u6210\u65f6\uff0c\u88ab\u8c03\u7528\u7684\u7c7b\u5c06\u8c03\u7528\u56de\u8c03\u51fd\u6570\uff0c\u5c06 index \u503c\u4f20\u9012\u56de\u4e3b\u7c7b\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u793a\u4f8b\u4ee3\u7801\uff1a<\/strong><\/p>\n<p>\u5728\u4e3b\u7c7b\uff08r\uff09\u4e2d\uff1a<\/p>\n<pre>public class r {\n    public void indexcallback(int index) {\n        \/\/ \u4f7f\u7528 index \u503c\u5b9e\u73b0\u5b9a\u4f4d\u529f\u80fd\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728a\u7c7b\uff08tihuan\uff09\u4e2d\uff1a<\/p>\n<pre>public class tihuan {\n    private r r;\n\n    public tihuan(r r, string listx) {\n        this.r = r;\n    }\n\n    public int find() {\n        \/\/ \u67e5\u627e\u5b57\u7b26\u5e76\u83b7\u53d6 index\n        \/\/ ...\n\n        \/\/ \u8c03\u7528\u56de\u8c03\u51fd\u6570\u4f20\u9012 index \u503c\n        r.indexcallback(index);\n    }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u4e3b\u7c7b\u4e2d\u4f7f\u7528\uff1a<\/p>\n<pre>Tihuan find = new Tihuan(this, youInput);\nfind.find();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u4f7f\u7528\u56de\u8c03\u51fd\u6570\uff0c\u53ef\u4ee5\u5728\u4e0d\u91cd\u65b0\u5b9e\u4f8b\u5316\u4e3b\u7c7b\u7684\u60c5\u51b5\u4e0b\u5c06 index \u503c\u4f20\u9012\u56de\u4e3b\u7c7b\uff0c\u4ece\u800c\u5b9e\u73b0\u5b9a\u4f4d\u529f\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728Java\u4e2d\u5c06\u503c\u4ece\u4e00\u4e2a\u7c7b\u4f20\u9012\u5230\u53e6\u4e00\u4e2a\u7c7b\uff0c\u800c\u4e0d\u91cd\u65b0\u5b9e\u4f8b\u5316\u4e3b\u7c7b\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>\u5c06\u503c\u4ece\u4e00\u4e2a\u7c7b\u4f20\u9012\u5230\u53e6\u4e00\u4e2a\u7c7b\u7684\u65b9\u6cd5 \u5728java\u4e2d\uff0c\u5f53\u9700\u8981\u5728\u4e0d\u540c\u7684\u7c7b\u4e4b\u95f4\u4f20\u9012\u503c\u65f6\uff0c\u6709\u51e0\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5b9e\u73b0\u3002\u5176\u4e2d\u4e00\u4e2a\u5e38\u89c1\u7684\u6311\u6218\u662f\u5728\u4e0d\u91cd\u65b0\u5b9e\u4f8b\u5316\u4e3b\u7c7b\u7684\u60c5\u51b5\u4e0b\uff0c\u5c06\u503c\u4f20\u9012\u56de\u4e3b\u7c7b\u3002 \u4e00\u79cd\u6709\u6548\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u8fd4\u56de\u65b9\u6cd5\u3002\u88ab\u8c03\u7528\u7684\u7c7b\uff08\u5373a\u7c7b\uff09\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u8fd4\u56de\u65b9\u6cd5\u6765\u8fd4\u56de\u6240\u9700\u7684 index \u503c\u3002\u7136\u540e\uff0c\u4e3b\u7c7b\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u8be5\u65b9\u6cd5\u6765\u68c0\u7d22 index \u503c\u3002 \u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u56de\u8c03\u51fd\u6570\u3002\u56de\u8c03\u51fd\u6570\u662f\u4e00\u4e2a\u4f20\u9012\u7ed9\u53e6\u4e00\u4e2a\u7c7b\u7684\u51fd\u6570\u6307\u9488\u3002\u5f53\u64cd\u4f5c\u5b8c\u6210\u65f6\uff0c\u88ab\u8c03\u7528\u7684\u7c7b\u5c06\u8c03\u7528\u56de\u8c03\u51fd\u6570\uff0c\u5c06 index \u503c\u4f20\u9012\u56de\u4e3b\u7c7b\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u793a\u4f8b\u4ee3\u7801\uff1a \u5728\u4e3b\u7c7b\uff08r\uff09\u4e2d\uff1a public class r { public void indexcallback(int index) { \/\/ \u4f7f\u7528 index \u503c\u5b9e\u73b0\u5b9a\u4f4d\u529f\u80fd } } \u767b\u5f55\u540e\u590d\u5236 \u5728a\u7c7b\uff08tihuan\uff09\u4e2d\uff1a public class tihuan { private r r; public tihuan(r r, string listx) { this.r = r; } public int find() { \/\/ \u67e5\u627e\u5b57\u7b26\u5e76\u83b7\u53d6 index \/\/ [&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-36140","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36140","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=36140"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36140\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=36140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=36140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=36140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}