{"id":156758,"date":"2019-09-18T10:46:15","date_gmt":"2019-09-18T02:46:15","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=156758"},"modified":"2019-08-29T15:47:18","modified_gmt":"2019-08-29T07:47:18","slug":"java-deep-analyse","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/java-deep-analyse.html","title":{"rendered":"\u4f60\u4e86\u89e3Java\u53cd\u5c04\u5417\uff1f"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u521a\u5f00\u59cb\u63a5\u89e6\u53cd\u5c04\u8fd9\u4e2a\u6982\u5ff5\uff0c\u611f\u89c9\u53cd\u5c04\u8fd9\u4e2a\u673a\u5236\u5f88\u590d\u6742\u5f88\u96be\u61c2\uff0c\u6240\u4ee5\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u5bf9Java\u7684\u53cd\u5c04\u673a\u5236\u4ee5\u4e2a\u4eba\u7684\u7406\u89e3\u603b\u7ed3\u5f52\u7eb3\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n 1. \u4ec0\u4e48\u662f\u53cd\u5c04\uff1f<\/strong><\/div>\n \u4ec0\u4e48\u662f\u53cd\u5c04\uff1f\u5728\u5b98\u65b9\u6587\u6863\u4e2d\u662f\u8fd9\u6837\u8bf4\u7684\uff1a \u7ffb\u8bd1\u4e00\u4e0b\uff1a<\/p>\n \u53cd\u5c04\u6280\u672f\u901a\u5e38\u88ab\u7528\u6765\u68c0\u6d4b\u548c\u6539\u53d8\u5e94\u7528\u7a0b\u5e8f\u5728 Java \u865a\u62df\u673a\u4e2d\u7684\u884c\u4e3a\u8868\u73b0\u3002\u5b83\u662f\u4e00\u4e2a\u76f8\u5bf9\u800c\u8a00\u6bd4\u8f83\u9ad8\u7ea7\u7684\u6280\u672f\uff0c\u901a\u5e38\u5b83\u5e94\u7528\u7684\u524d\u63d0\u662f\u5f00\u53d1\u8005\u672c\u8eab\u5bf9\u4e8e Java \u8bed\u8a00\u7279\u6027\u6709\u5f88\u5f3a\u7684\u7406\u89e3\u7684\u57fa\u7840\u4e0a\u3002\u503c\u5f97\u8bf4\u660e\u7684\u662f\uff0c\u53cd\u5c04\u662f\u4e00\u79cd\u5f3a\u6709\u529b\u7684\u6280\u672f\u7279\u6027\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f7f\u5f97\u5e94\u7528\u7a0b\u5e8f\u6267\u884c\u4e00\u4e9b\u5e38\u89c4\u624b\u6bb5\u65e0\u6cd5\u4f01\u53ca\u7684\u76ee\u7684\u3002<\/p>\n \u4e2a\u4eba\u7406\u89e3\uff1a\u53cd\u5c04\u662f\u4e00\u79cd\u5f88\u725bx\u7684\u6280\u672f\uff0c\u4f7f\u7528\u53cd\u5c04\u7684\u6761\u4ef6\u662f\u7a0b\u5e8f\u733f\u662f\u4e00\u4e2a\u5927\u733f\uff0c\u5bf9java\u7684\u7279\u6027\u975e\u5e38\u7406\u89e3\u3002\u53cd\u5c04\u7684\u725b\u903c\u4e4b\u5904\u5728\u4e8e\u4ed6\u53ef\u4ee5\u5b8c\u6210\u4e00\u4e9b\u975e\u5e38\u89c4\u64cd\u4f5c\u3002<\/p>\n \u4e3e\u4e2a\u6817\u5b50\u6765\u8bf4\u660e\u4e00\u4e0b\uff1a<\/p>\n \u7a0d\u5fae\u60f3\u4e86\u4e00\u4e0b\uff0c\u89c9\u5f97\u7528\u716e\u996d\u8fd9\u4e2a\u6817\u5b50\u6765\u8bf4\u660e\u5427\uff0c\u4e0d\u77e5\u9053\u51c6\u4e0d\u51c6\u786e\uff08^,^\uff09\u3002\u5e73\u65f6\u6211\u4eec\u5728\u5bb6\u91cc\u4e00\u822c\u662f\u7528\u7535\u996d\u7172\u6765\u716e\u996d\u7684\uff0c\u716e\u996d\u7684\u6b65\u9aa4\u4e00\u822c\u662f\uff1a\u6dd8\u7c73\u2014\u2014>\u64e6\u5e72\u9505\u5e95\u2014\u2014>\u628a\u9505\u653e\u5230\u7535\u996d\u7172\u91cc\u2014\u2014>\u5408\u4e0a\u76d6\u5b50\uff0c\u901a\u7535\uff0c\u7535\u996d\u7172\u5de5\u4f5c\u2014\u2014>\u996d\u716e\u719f\u4e86\uff0c\u53ef\u4ee5\u5403\u4e86\uff0c\u4f46\u73b0\u5728\u6709\u4e2a\u9700\u6c42\uff0c\u6211\u8981\u5728\u716e\u996d\u7684\u8fc7\u7a0b\u4e2d\u52a0\u4e2a\u9e21\u86cb\uff0c\u8fd9\u65f6\u600e\u4e48\u89e3\u51b3\u5462\uff1f\u662f\u4e0d\u662f\u6253\u5f00\u6b63\u5728\u901a\u7535\u716e\u996d\u7684\u7535\u996d\u7172\uff0c\u7136\u540e\u628a\u9e21\u86cb\u653e\u8fdb\u53bb\u5462\uff1f\uff08\u6765\u81ea\u5403\u8d27\u7684\u9700\u6c42^_^\uff09\u5176\u5b9e\u53cd\u5c04\u5c31\u76f8\u5f53\u4e8e\u521a\u624d\u52a0\u9e21\u86cb\u7684\u8fc7\u7a0b\u3002\u6240\u4ee5\u53cd\u5c04\u5f88\u725b\u903c\uff0c\u4ed6\u4e0d\u6309\u5e38\u89c4\u5957\u8def\u51fa\u724c\uff0c\u5728\u7a0b\u5e8f\u8fd0\u884c\u7684\u8fc7\u7a0b\u4e2d\u641e\u4e00\u4e9b\u5c0f\u52a8\u4f5c\uff0c\u4ee5\u8fbe\u5230\u201c\u5403\u8d27\u201d\u7684\u76ee\u7684\u3002\u8865\u5145\u4e00\u4e0b\uff1a\u201c\u6dd8\u7c73\u2014\u2014>\u64e6\u5e72\u9505\u5e95\u2014\u2014>\u628a\u9505\u653e\u5230\u7535\u996d\u7172\u91cc\u2014\u2014>\u201d\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u4ee5\u770b\u505a\u7f16\u7801\u7f16\u8bd1\u8fc7\u7a0b\uff0c\u201c\u2014\u2014>\u5408\u4e0a\u76d6\u5b50\uff0c\u901a\u7535\uff0c\u7535\u996d\u7172\u5de5\u4f5c\u201d\u53ef\u4ee5\u770b\u505a\u662f\u7a0b\u5e8f\u8fd0\u884c\u8fc7\u7a0b\uff0c\u201c\u2014\u2014>\u996d\u716e\u719f\u4e86\uff0c\u53ef\u4ee5\u5403\u4e86\u201d\u53ef\u4ee5\u770b\u505a\u7a0b\u5e8f\u8fd0\u884c\u7ed3\u675f\u3002 2.java\u4e2d\u7684\u53cd\u5c04\u673a\u5236<\/strong><\/div>\n 2.1 \u53cd\u5c04\u4e2d\u5e38\u89c1\u7684\u7c7b<\/strong><\/span><\/div>\n \u7406\u89e3\u53cd\u5c04\u673a\u5236\u65f6\uff0c\u9996\u5148\u719f\u6089\u4e00\u4e0b\u51e0\u4e2a\u7c7b\uff1a<\/p>\n 1\uff09Class\u7c7b<\/strong><\/p>\n Class\u7c7b\u5b9e\u4f8b\u8868\u793a\u6b63\u5728\u8fd0\u884c\u7684Java\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u7c7b\u548c\u63a5\u53e3\u3002Class\u662f\u666e\u901a\u7c7b\u3001\u63a5\u53e3\u3001\u679a\u4e3e\u7c7b\u3001\u6570\u7ec4\u7b49\u7684\u62bd\u8c61\uff0c\u5373\u5b83\u4eec\u7684\u7c7b\u578b\u5c31\u662fClass\uff0c\u5b83\u4eec\u662fClass\u7684\u5b9e\u4f8b\u3002<\/p>\n \u65e2\u7136Class\u4ee3\u8868\u7740\u7c7b\u548c\u63a5\u53e3\uff0c\u90a3\u4e48\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4ed6\u7684\u5b9e\u4f8b\uff08\u5b57\u8282\u7801\u6587\u4ef6\uff09\u6765\u83b7\u53d6\u5bf9\u5e94\u7c7b\u6216\u63a5\u53e3\u7684\u4fe1\u606f\uff0c\u5982\uff1a\u6ce8\u89e3\u3001\u4fee\u9970\u7b26\u3001\u7c7b\u578b\u3001\u7c7b\u7684\u540d\u79f0\u3001\u5c5e\u6027\u3001\u65b9\u6cd5\u3001\u6784\u9020\u65b9\u6cd5\u3001\u76f4\u63a5\u7236\u7c7b\u548c\u5b50\u7c7b\u7b49\uff0c\u8fd8\u6709\u53ef\u4ee5\u521b\u5efa\u5b83\u7684\u5b9e\u4f8b\uff0c\u4f46\u53ea\u80fd\u8c03\u7528\u65e0\u53c2\u6784\u9020\u65b9\u6cd5\u6765\u521b\u5efa\u3002<\/p>\n \u4ec0\u4e48\u770b\u4e0d\u61c2\uff1f\u4e3e\u4e2a\u6817\u5b50\uff0c\u6211\u4eec\u90fd\u77e5\u9053\uff0c\u751f\u7269\u53ef\u4ee5\u5206\u4e3a\u52a8\u7269\u3001\u690d\u7269\u3001\u5fae\u751f\u7269\u548c\u75c5\u6bd2\u7b49\uff0c\u800c\u52a8\u7269\u53c8\u6709\u4eba\u3001\u55b5\u661f\u4eba\u3001\u5c0f\u72d7\u7b49\uff0c\u690d\u7269\u3001\u5fae\u751f\u7269\u548c\u75c5\u6bd2\u4e5f\u4e00\u6837\u3002\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u7c7b\u6bd4\u4e00\u4e0b\uff0c\u751f\u7269\u5c31\u662fClass\uff0c\u52a8\u7269\u662f\u666e\u901a\u7c7b\uff0c\u690d\u7269\u662f\u63a5\u53e3\uff0c\u5fae\u751f\u7269\u662f\u679a\u4e3e\u7c7b\u3001\u75c5\u6bd2\u662f\u6570\u7ec4\uff08\u679a\u4e3e\u548c\u6570\u7ec4\u662f\u7279\u6b8a\u7684\u7c7b\uff09\uff0c\u800c\u4eba\u3001\u55b5\u661f\u4eba\u3001\u5c0f\u72d7\u662f\u6211\u4eec\u719f\u6089\u7684\u5bf9\u8c61\uff0c\u5982\u56fe 2\uff09Field\u7c7b<\/strong><\/p>\n Field\u8868\u793a\u7c7b\u7684\u5c5e\u6027\uff0c\u5c5e\u6027\u542b\u6709\u4fee\u9970\u7b26\u3001\u7c7b\u578b\u3001\u5c5e\u6027\u540d\u79f0\u548c\u503c\u3002\u6240\u4ee5\u53ef\u4ee5\u901a\u8fc7Field\u7684\u5b9e\u4f8b\u83b7\u53d6\u5c5e\u6027\u7684\u4fee\u9970\u7b26\u3001\u7c7b\u578b\u3001\u5c5e\u6027\u540d\u79f0\uff0c\u5e76\u4e14\u53ef\u4ee5\u4fee\u6539\u5c5e\u6027\u7684\u503c\u3002<\/p>\n 3\uff09Method\u7c7b<\/strong><\/p>\n Method\u8868\u793a\u7c7b\u7684\u6210\u5458\u65b9\u6cd5\uff0c\u65b9\u6cd5\u5305\u62ec\u6ce8\u89e3\u3001\u4fee\u9970\u7b26\u3001\u8fd4\u56de\u7c7b\u578b\u3001\u65b9\u6cd5\u540d\uff0c\u53c2\u6570\u7b49\u3002\u6240\u4ee5\u53ef\u4ee5\u901a\u8fc7Method\u7684\u5b9e\u4f8b\u83b7\u53d6\u65b9\u6cd5\u7684\u7684\u4fe1\u606f\uff0c\u5982\uff0c\u6ce8\u89e3\u3001\u4fee\u9970\u7b26\u3001\u8fd4\u56de\u7c7b\u578b\u3001\u65b9\u6cd5\u540d\u5e76\u4e14\u53ef\u4ee5\u8c03\u7528\u6240\u8868\u793a\u7684\u65b9\u6cd5\u3002<\/p>\n 4\uff09Constructor\u7c7b<\/strong><\/p>\n Constructor\u8868\u793a\u6784\u9020\u65b9\u6cd5\uff0c\u53ef\u4ee5\u901a\u8fc7Constructor\u7684\u5b9e\u4f8b\u83b7\u53d6\u6784\u9020\u65b9\u6cd5\u7684\u4fe1\u606f\uff0c\u5982\uff0c\u4fee\u9970\u7b26\u7b49\uff0c\u5e76\u4e14\u53ef\u4ee5\u901a\u8fc7\u5b83\u6765\u521b\u5efa\u5b83\u6240\u5728\u7c7b\u7684\u7684\u5b9e\u4f8b\u3002<\/p>\n 5\uff09Modifier\u7c7b<\/strong><\/p>\n Modifier\u8868\u793a\u4fee\u9970\u7b26\uff0c\u53ef\u901a\u8fc7\u5b83\u6765\u83b7\u53d6\u4fee\u9970\u7b26\u7684\u4fe1\u606f\uff0c\u4f8b\u5982\u4f55\u79cd\u4fee\u9970\u7b26\u7b49<\/p>\n 6\uff09Annotation<\/strong><\/p>\n Annotation\u4ee3\u8868\u6ce8\u89e3<\/p>\n \u4ee5\u4e0a\u7c7b\u90fd\u4f4d\u4e8ejava.lang\u4e2d<\/p>\n \u4e86\u89e3\u4e86\u4ec0\u4e48\u662f\u53cd\u5c04\u540e\uff0c\u662f\u4e0d\u662f\u4e5f\u60f3\u4f53\u9a8c\u4e00\u4e0b\u53cd\u5c04\u8fd9\u79cd\u9a9a\u64cd\u4f5c\uff1f<\/p>\n \u60f3\u79c0\u64cd\u4f5c\uff0c\u9996\u5148\u8981\u83b7\u53d6Class\u5bf9\u8c61\u5427\uff0c\u56e0\u4e3aClass\u5bf9\u8c61\u662f\u4ee3\u8868\u7740\u5404\u79cd\u7c7b\uff0c\u6709\u4e86\u5b83\u4e4b\u540e\u624d\u53ef\u4ee5\u5f97\u5230\u7c7b\u7684\u5404\u79cd\u4fe1\u606f\u3002\u83b7\u53d6\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n 1\uff09\u901a\u8fc7object.getClass()<\/strong><\/p>\n \u6ce8\u610f\uff1a\u6b64\u65b9\u6cd5\u4e0d\u9002\u7528\u4e8eint\u3001float\u7b49\u7c7b\u578b<\/p>\n 2\uff09\u901a\u8fc7(\u7c7b\u578b\u540d).class\u3001\u5305\u88c5\u7c7b.Type<\/strong><\/p>\n 3\uff09\u901a\u8fc7Class.forClass(String \u7c7b\u7684\u5168\u9650\u5b9a\u540d\uff09<\/strong><\/p>\n \u91c7\u7528\u54ea\u79cd\u65b9\u6cd5\u6765\u83b7\u53d6\uff0c\u770b\u5b9e\u9645\u60c5\u51b5\u800c\u5b9a\u3002<\/p>\n \u6709\u4e86Class\u5bf9\u8c61\u540e\uff0c\u5c31\u53ef\u4ee5\u83b7\u53d6\u7c7b\u7684\u6210\u5458\uff08\u65b9\u6cd5+\u5c5e\u6027\uff09\u3001\u6ce8\u89e3\u548c\u7c7b\u7684\u4fee\u9970\u7b26\u7b49\u3002\u4e0a\u9762\u4e5f\u8bf4\u4e86\uff0cjava\u4e2d\u65b9\u6cd5\u7528Method\u7c7b\u8868\u793a\u3001\u5c5e\u6027\u7528Field\u7c7b\u8868\u793a\u3001\u6ce8\u89e3\u7528Annotation\u7c7b\u6765\u8868\u793a\u3001\u4fee\u9970\u7b26\u7528Modifier\u7c7b\u8868\u793a\u3002Class\u7c7b\u4e2d\u6709\u5bf9\u5e94\u7684\u65b9\u6cd5\u6765\u83b7\u53d6\u4ed6\u4eec\u3002\u5982\u4e0b\uff1a<\/p>\n 2.3.1 \u83b7\u53d6\u5c5e\u6027Field\u7684\u5bf9\u8c61<\/strong><\/p>\n 2.3.2 \u83b7\u53d6\u65b9\u6cd5Method\u5bf9\u8c61<\/strong><\/p>\n 2.3.3 \u83b7\u53d6\u6784\u9020\u5668Constructor\u5bf9\u8c61<\/strong><\/p>\n \u6784\u9020\u65b9\u6cd5\u7684\u83b7\u53d6\u4e0e\u666e\u901a\u65b9\u6cd5\u7684\u83b7\u53d6\u5927\u81f4\u662f\u4e00\u6837\u7684\u3002<\/p>\n ------------------------------------------------------------------<\/p>\n \u4ee5\u4e0a\u7684\u65b9\u6cd5\u90fd\u662f\u5728Class\u7c7b\u4e2d\uff0c\u522b\u50bb\u50bb\u4e0d\u77e5\u9053\uff08\u522b\u95ee\u6211\u600e\u4e48\u77e5\u9053\u7684>_>\uff09,\u7136\u540e\u901a\u8fc7Class\u5bf9\u8c61\u8c03\u7528\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n \u8fd9\u91cc\u53ea\u662f\u5217\u4e3e\u4e86\u5e38\u7528\u7c7b\u4fe1\u606f\u7684\u7684\u83b7\u53d6\u65b9\u6cd5\uff0c\u5176\u4ed6\u4fe1\u606f\u7684\u83b7\u53d6\u65b9\u6cd5\uff0c\u770bAPI\u6587\u6863\u5427\uff0c\u5982\u6ce8\u89e3\u3001\u7c7b\u7684Class\u7684\u5bf9\u8c61\uff08\u989d\u597d\u50cf\u6709\u70b9\u7ed5\u3002\u3002\u3002\uff09\u7b49.<\/p>\n \u4e0a\u9762\u53ea\u662f\u83b7\u53d6\u4e86\u7c7b\u7684\u6210\u5458\u6240\u4ee3\u8868\u7c7b\u7684\u5bf9\u8c61\uff0c\u6211\u4eec\u8fd8\u8981\u4f7f\u7528\u4ed6\u4eec\u6216\u8005\u83b7\u53d6\u6210\u5458\u7684\u4fe1\u606f\uff08\u540d\u79f0\u3001\u4fee\u9970\u7b26\u7b49\uff09\u3002\u56e0\u4e3a\u6709\u4e86\u4ee3\u8868\u6210\u5458\u7684\u5bf9\u8c61\uff0c\u4f7f\u7528\u5bf9\u8c61\u8c03\u7528\u5b9e\u4f8b\u65b9\u6cd5\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n 2.4.1 Field\u7c7b<\/strong><\/p>\n Field\u7c7b\u7684\u65b9\u6cd5\u5927\u6982\u53ef\u4ee5\u5206\u4e3a\u4e24\u79cd\uff0c\u4e00\u79cd\u662f\u83b7\u53d6\u5c5e\u6027\u7684\u4fe1\u606f\uff0c\u53e6\u5916\u4e00\u79cd\u662f\u8bbe\u7f6e\u5c5e\u6027\u7684\u503c\u3002<\/p>\n \u7b2c\u4e00\u79cd\uff1a<\/p>\n \u7b2c\u4e8c\u79cd\uff1a<\/p>\n \u6ce8\u610f\u5566\uff1a\u5982\u679c\u6ca1\u6709\u8bbf\u95ee\u6743\u9650\u7684\u8bdd\uff0c\u9ed8\u8ba4\u662f\u4e0d\u80fd\u8bbe\u7f6e\u5c5e\u6027\u503c\u7684\uff0c\u90a3\ufffd\ufffd\u4e48\u529e\u5462\uff1f\u662f\u4e0d\u662f\u5c31\u79c0\u4e0d\u4e86\u64cd\u4f5c\u4e86\uff1f\u7136\u800c\uff0c\u524d\u9762\u4e5f\u8bf4\u4e86\uff0c\u53cd\u5c04\u5f88\u725b\u903c\uff0c\u53ef\u4ee5\u6765\u4e00\u4e9b\u975e\u5e38\u89c4\u64cd\u4f5c\uff0c 2.4.3 Constructor\u7c7b<\/strong> \u83b7\u53d6\u65b9\u6cd5\u4fe1\u606f\uff1a<\/p>\n \u521b\u5efa\u5bf9\u8c61\u7684\u65b9\u6cd5\u5148\u4e0d\u8bf4\uff0c\u653e\u5230\u540e\u9762\u53bb\u3002<\/p>\n 2.5.1 \u521b\u5efa\u666e\u901a\u7c7b\u7684\u5bf9\u8c61<\/strong><\/p>\n \u521b\u5efa\u666e\u901a\u7c7b\u7684\u5bf9\u8c61\u53ef\u4ee5\u5206\u4e3a\u4e24\u79cd\u65b9\u6cd5<\/p>\n \u7b2c\u4e00\u79cd\uff1a\u8c03\u7528Class\u5bf9\u8c61\u7684\u65b9\u6cd5<\/p>\n \u7b2c\u4e8c\u79cd\uff1a\u901a\u8fc7Constructor\u7684newInstance\uff08\uff09\u65b9\u6cd5<\/p>\n 2.5.2 \u521b\u5efa\u6570\u7ec4<\/strong><\/p>\n \u6570\u7ec4\u672c\u8d28\u4e0a\u662f\u4e00\u4e2a Class\uff0c\u800c\u5728 Class \u4e2d\u5b58\u5728\u4e00\u4e2a\u65b9\u6cd5\u7528\u6765\u8bc6\u522b\u5b83\u662f\u5426\u4e3a\u4e00\u4e2a\u6570\u7ec4\u3002<\/p>\n \u53cd\u5c04\u521b\u5efa\u6570\u7ec4\u662f\u901a\u8fc7 Array.newInstance(T.class,\u7ef4\u6570) \u8fd9\u4e2a\u65b9\u6cd5\u3002<\/p>\n \u7b2c\u4e00\u4e2a\u53c2\u6570\u6307\u5b9a\u7684\u662f\u6570\u7ec4\u5185\u7684\u5143\u7d20\u7c7b\u578b\uff0c\u540e\u9762\u7684\u662f\u53ef\u53d8\u53c2\u6570\uff0c\u8868\u793a\u7684\u662f\u76f8\u5e94\u7ef4\u5ea6\u7684\u6570\u7ec4\u957f\u5ea6\u9650\u5236\u3002<\/p>\n \u6bd4\u5982\uff0c\u6211\u8981\u521b\u5efa\u4e00\u4e2a int[2][3] \u7684\u6570\u7ec4\u3002<\/p>\n 2.5.3 \u8c03\u7528\u65b9\u6cd5<\/strong><\/p>\n \u7528\u4e86\u4e0a\u9762\u7684\u65b9\u6cd5\uff0c\u5c31\u6709Class\u5bf9\u8c61\uff0c\u6709\u65b9\u6cd5Method\u5bf9\u8c61\uff0c\u6709\u5b9e\u4f8b\uff0c\u73b0\u5728\u5df2\u7ecf\u4e07\u4e8b\u4ff1\u5907\uff0c\u53ea\u6b20\u4e1c\u98ce\u4e86\u3002<\/p>\n \u90a3\u6211\u4eec\u600e\u4e48\u8c03\u7528\u65b9\u6cd5\u5462\uff1f\u5728Method\u7c7b\u6709\u8fd9\u4e48\u4e00\u4e2a\u65b9\u6cd5Object invoke(Object obj, Object... args\uff09\uff0cobject\u4e3a\u5b9e\u4f8b\u5bf9\u8c61\uff0cargs\u4e3a\u8c03\u7528\u65b9\u6cd5\u7684\u53c2\u6570<\/p>\n \u6765\u4e2a\u6817\u5b50\uff1a<\/p>\n \u770b\u5230\u8fd9\u91cc\u662f\u4e0d\u662f\u6709\u4e2a\u7591\u95ee\uff0c\u53cd\u5c04\u8c03\u7528\u7c7b\u7684\u65b9\u6cd5\u597d\u50cf\u9664\u4e86\u590d\u6742\u4e4b\u5916\uff0c\u8ddf\u6211\u4eec\u5e73\u65f6\u8c03\u7528\u6ca1\u4ec0\u4e48\u533a\u522b\u3002\u4f55\u5fc5\u5f04\u90a3\u4e48\u82b1\u91cc\u80e1\u54e8\uff1f<\/p>\n \u6240\u4ee5\u5728\u8fd9\u91cc\u7b80\u5355\u8bf4\u4e00\u4e0b\u9759\u6001\u52a0\u8f7d\u4e0e\u52a8\u6001\u52a0\u8f7d\u3002<\/p>\n \u56de\u60f3\u4e00\u4e0b\u4e4b\u524d\u716e\u996d\u7684\u90a3\u4e2a\u6817\u5b50\uff0c\u9759\u6001\u52a0\u8f7d\u548c\u52a8\u6001\u52a0\u8f7d\u7684\u8fd9\u4e2a\u4f8b\u5b50\u6709\u70b9\u76f8\u4f3c\u3002<\/p>\n \u9759\u6001\u52a0\u8f7d\uff1a\u6211\u4eec\u5728\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u7c7b\u65f6\uff0c\u9759\u6001\u52a0\u8f7d\u662f\u8981\u6c42\u8981\u4f7f\u7528\u7684\u7c7b\u5fc5\u987b\u8981\u6c42\u5728\u7f16\u8bd1\u7684\u65f6\u5019\u5b58\u5728\uff0c\u5426\u5219\u7f16\u8bd1\u5668\u62a5\u9519\uff0c\u65e0\u6cd5\u8fd0\u884c\u7a0b\u5e8f\u3002\u7f16\u7801\u65f6\u5fd8\u8bb0\u5bfc\u5305\u65f6\uff0c\u7ecf\u5e38\u4f1a\u51fa\u73b0\u8fd9\u79cd\u9519\u8bef\u3002<\/p>\n \u52a8\u6001\u52a0\u8f7d\uff1a\u5229\u7528\u53cd\u5c04\u6765\u52a0\u8f7d\u7c7b\uff08\u5373\u83b7\u5f97Class\u5bf9\u8c61\uff09\uff0c\u4e0d\u8981\u6c42\u6211\u4eec\u5728\u7f16\u8bd1\u671f\u5b58\u5728\u8981\u662f\u7528\u7684\u90a3\u4e2a\u7c7b\uff0c\u5728\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u624d\u53bb\u5bfb\u627e\u7c7b\uff08\u53ef\u4ee5\u4ecejar\u5305\uff0c\u7f51\u7edc\u7b49\u5bfb\u627e\uff09\uff0c\u7136\u540e\u628a\u7c7b\u52a0\u8f7d\u5230\u65b9\u6cd5\u533a\u4e2d\uff0c\u5982\u679c\u6ca1\u6709\u627e\u5230\u8fd9\u4e2a\u7c7b\u4f1a\u629b\u51faClassNotFoundException\u5f02\u5e38\u3002<\/p>\n \u6709\u56fe\u6709\u771f\u76f8\uff1a \u8fd9\u4e0b\u770b\u51fa\u6765\u53cd\u5c04\u7684\u725b\u903c\u4e4b\u5904\u4e86\u5427\uff0c\u5229\u7528\u53cd\u5c04\u4f7f\u7528\u7c7b\u65f6\uff0c\u5e76\u4e0d\u9700\u8981\u8fd9\u4e2a\u7c7b\u5728\u7f16\u8bd1\u671f\u5b58\u5728\uff0c\u8fd9\u5c31\u589e\u52a0\u4e86\u7a0b\u5e8f\u7684\u7075\u6d3b\u6027\uff0c\u53ef\u4ee5\u5b8c\u6210\u6211\u4eec\u7684\u9a9a\u64cd\u4f5c\uff01<\/p>\n \u6700\u540e\u603b\u7ed3\u4e00\u4e0b\uff1a<\/p>\n \u4f7f\u7528\u53cd\u5c04\u65f6\uff0c\u8bb0\u4f4f\u4e00\u53e5\u8bdd\uff1a\u8001\u54e5\uff0c\u7a33\u4f4f\uff0c\u522b\u7ffb\u8f66\uff01<\/p>\n","protected":false},"excerpt":{"rendered":" \u4ec0\u4e48\u662f\u53cd\u5c04\uff1f\u5728\u5b98\u65b9\u6587\u6863\u4e2d\u662f\u8fd9\u6837\u8bf4\u7684\uff1a Reflection is commonly used by progr […]<\/p>\n","protected":false},"author":63,"featured_media":156761,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-156758","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=156758"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156758\/revisions"}],"predecessor-version":[{"id":157511,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156758\/revisions\/157511"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/156761"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=156758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=156758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=156758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |