ResouceBundle读取properties文件java
public class TestResourceBundle { static ResourceBundle bundle; static { bundle = ResourceBundle.getBundle("test", Locale.ENGLISH); } public static void main(String[] args) { System.err.println("name:"+bundle.getString("name")); } }
利用jdk7自带的ResourceBundle类读取properties文件,只须要告诉他文件名称,就能够简单获取指定名称,无需本身写方法了,简单易用code