方法一:通过java.util.Properties读取
Properties p=new Properties();
//p需要InputStream对象进行读取文件,而获取InputStream有多种方法:
//1、通过绝对路径:InputStream is=new FileInputStream(filePath);
//2、通过Class.getResourceAsStream(path);
//3、通过ClassLoader.getResourceAsStream(path);
p.load(InputStream is);
is.close();
p.getString(String(key))
方法二:通过java.util.ResourceBundle读取
ResourceBundle rb=ResourceBundle.getBundle(packageName);
rb.getString(String key);