{"id":35999,"date":"2024-11-26T10:29:20","date_gmt":"2024-11-26T02:29:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/35999\/"},"modified":"2024-11-26T10:29:20","modified_gmt":"2024-11-26T02:29:20","slug":"%e5%8f%8d%e5%b0%84%e4%b8%adnosuchmethodexception%e5%bc%82%e5%b8%b8%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bb%a3%e7%a0%81%e8%b0%83%e7%94%a8getname%e6%96%b9%e6%b3%95%e4%bc%9a%e6%8a%9b%e5%87%banosuchmeth","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/35999\/","title":{"rendered":"\u53cd\u5c04\u4e2dNoSuchMethodException\u5f02\u5e38\uff1a\u4e3a\u4ec0\u4e48\u4ee3\u7801\u8c03\u7528getName\u65b9\u6cd5\u4f1a\u629b\u51faNoSuchMethodException\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173086964170780.jpg\" class=\"aligncenter\" title=\"\u53cd\u5c04\u4e2dNoSuchMethodException\u5f02\u5e38\uff1a\u4e3a\u4ec0\u4e48\u4ee3\u7801\u8c03\u7528getName\u65b9\u6cd5\u4f1a\u629b\u51faNoSuchMethodException\uff1f\u63d2\u56fe\" alt=\"\u53cd\u5c04\u4e2dNoSuchMethodException\u5f02\u5e38\uff1a\u4e3a\u4ec0\u4e48\u4ee3\u7801\u8c03\u7528getName\u65b9\u6cd5\u4f1a\u629b\u51faNoSuchMethodException\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u53cd\u5c04 nosuchmethodexception<\/strong><\/p>\n<p>\u5728\u53cd\u5c04\u4e2d\uff0cnosuchmethodexception \u5f02\u5e38\u8868\u793a\u627e\u4e0d\u5230\u5177\u6709\u6307\u5b9a\u7b7e\u540d\u7684\u65b9\u6cd5\u3002\u5f53\u5c1d\u8bd5\u8c03\u7528\u4ee3\u7801\u4e2d\u4e0d\u5b58\u5728\u7684\u65b9\u6cd5\u65f6\uff0c\u4f1a\u629b\u51fa\u6b64\u5f02\u5e38\u3002<\/p>\n<p><strong>\u95ee\u9898\u5206\u6790<\/strong><\/p>\n<p>\u7ed9\u5b9a\u7684\u4ee3\u7801\u793a\u4f8b\u65e8\u5728\u4f7f\u7528\u53cd\u5c04\u4ece user \u7c7b\u4e2d\u83b7\u53d6 getname \u65b9\u6cd5\u3002\u7136\u800c\uff0c\u5f53\u5c1d\u8bd5\u83b7\u53d6\u5177\u6709 string \u53c2\u6570\u7684\u65b9\u6cd5\u65f6\uff0c\u4f1a\u629b\u51fa nosuchmethodexception\u3002\u8fd9\u662f\u56e0\u4e3a getname \u65b9\u6cd5\u5728 user \u7c7b\u4e2d\u672a\u58f0\u660e\u4e3a\u63a5\u53d7\u4efb\u4f55\u53c2\u6570\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bf7\u4fee\u6539\u4ee3\u7801\u4ee5\u83b7\u53d6\u4e0d\u5e26\u53c2\u6570\u7684 getname \u65b9\u6cd5\uff1a<\/p>\n<pre>Method method = c.getMethod(\"getName\");<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4fee\u6539\u540e\u7684\u4ee3\u7801\u5c06\u6210\u529f\u83b7\u53d6 getname \u65b9\u6cd5\u5e76\u8c03\u7528\u5b83\uff0c\u800c\u4e0d\u4f1a\u629b\u51fa nosuchmethodexception\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u53cd\u5c04\u4e2dNoSuchMethodException\u5f02\u5e38\uff1a\u4e3a\u4ec0\u4e48\u4ee3\u7801\u8c03\u7528getName\u65b9\u6cd5\u4f1a\u629b\u51faNoSuchMethodException\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>\u53cd\u5c04 nosuchmethodexception \u5728\u53cd\u5c04\u4e2d\uff0cnosuchmethodexception \u5f02\u5e38\u8868\u793a\u627e\u4e0d\u5230\u5177\u6709\u6307\u5b9a\u7b7e\u540d\u7684\u65b9\u6cd5\u3002\u5f53\u5c1d\u8bd5\u8c03\u7528\u4ee3\u7801\u4e2d\u4e0d\u5b58\u5728\u7684\u65b9\u6cd5\u65f6\uff0c\u4f1a\u629b\u51fa\u6b64\u5f02\u5e38\u3002 \u95ee\u9898\u5206\u6790 \u7ed9\u5b9a\u7684\u4ee3\u7801\u793a\u4f8b\u65e8\u5728\u4f7f\u7528\u53cd\u5c04\u4ece user \u7c7b\u4e2d\u83b7\u53d6 getname \u65b9\u6cd5\u3002\u7136\u800c\uff0c\u5f53\u5c1d\u8bd5\u83b7\u53d6\u5177\u6709 string \u53c2\u6570\u7684\u65b9\u6cd5\u65f6\uff0c\u4f1a\u629b\u51fa nosuchmethodexception\u3002\u8fd9\u662f\u56e0\u4e3a getname \u65b9\u6cd5\u5728 user \u7c7b\u4e2d\u672a\u58f0\u660e\u4e3a\u63a5\u53d7\u4efb\u4f55\u53c2\u6570\u3002 \u89e3\u51b3\u65b9\u6cd5 \u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bf7\u4fee\u6539\u4ee3\u7801\u4ee5\u83b7\u53d6\u4e0d\u5e26\u53c2\u6570\u7684 getname \u65b9\u6cd5\uff1a Method method = c.getMethod(&#8220;getName&#8221;); \u767b\u5f55\u540e\u590d\u5236 \u4fee\u6539\u540e\u7684\u4ee3\u7801\u5c06\u6210\u529f\u83b7\u53d6 getname \u65b9\u6cd5\u5e76\u8c03\u7528\u5b83\uff0c\u800c\u4e0d\u4f1a\u629b\u51fa nosuchmethodexception\u3002 \u4ee5\u4e0a\u5c31\u662f\u53cd\u5c04\u4e2dNoSuchMethodException\u5f02\u5e38\uff1a\u4e3a\u4ec0\u4e48\u4ee3\u7801\u8c03\u7528getName\u65b9\u6cd5\u4f1a\u629b\u51faNoSuchMethodException\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-35999","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35999","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=35999"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35999\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=35999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=35999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=35999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}