java 中 Properties 读取配置文件

在 ”雷达“ 小游戏中 读取 classpath (工程)配置文件 :

Properties pro=new Properties();
try {
pro.load(this.getClass().getClassLoader().getResourceAsStream("config/tank.properties"));
} catch (IOException e1) {
e1.printStackTrace();
}
int initFlyCount=Integer.parseInt(pro.getProperty("initFlyCount"));