0
点赞
收藏
分享

微信扫一扫

java操作properties文件

phpworkerman 2022-11-04 阅读 122

Java文件


public class Test {


public static void main(String[] args) throws IOException,InstantiationException, IllegalAccessException, ClassNotFoundException {


Properties pros=new Properties();


pros.load(Test.class.getClassLoader().getResourceAsStream("com/ygl/spring/factory/spring.properties"));


String vehicleType=pros.getProperty("VehicleType");


Object o=Class.forName(vehicleType).newInstance();


Move m=(Move)o;


m.run();


}


}

举报

相关推荐

0 条评论