标签:row method throw win reader config rop void col
要改变功能而修改源代码,可通过配置文件实现:
public static void main(String[] args) throws Exception{ FileReader f=new FileReader("src/wei/cn/demo/config.properties"); Properties pro=new Properties(); pro.load(f); //已经载入,可关闭资源 f.close(); String className=pro.getProperty("className"); String method=pro.getProperty("method"); Class c=Class.forName(className); Object obj=c.newInstance(); Method m=c.getMethod(method); m.invoke(obj); }
文件:
config.properties:
标签:row method throw win reader config rop void col
原文地址:https://www.cnblogs.com/findlisa/p/10787610.html