⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertymgr.java

📁 一个基于JAVA的小游戏
💻 JAVA
字号:
package com.bjsxt.tank.core;


import java.io.IOException;
import java.util.Properties;


public class PropertyMgr {
	private static Properties props = new Properties();
	static {
		try {
			props.load(PropertyMgr.class.getResourceAsStream("/tank.properties"));
			//props.load(PropertyMgr.class.getResourceAsStream("/tank.properties"));
			//props.load(new PropertyMgr().getClass().getResourceAsStream("tank.properties"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static String getProps(String key){
		return props.getProperty(key);
	}
	public static int getPropsInt(String key){
		String s = props.getProperty(key);
		if(s==null && s.equals("")){
			return 0;
		}
		return Integer.parseInt(s.trim());
	}
	public static void main(String[] args) {
		//String s = PropertyMgr.getProps("tank.initCount");
		int i = PropertyMgr.getPropsInt("tank.initCount");
		System.out.println(i);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -