获取properties文件中的

1、配置文件

 2、配置文件内容

 3、测试代码

public class Test {
    public static void main(String[] args) throws UnsupportedEncodingException {

        Locale locale = Locale.getDefault();
        ResourceBundle bundle = ResourceBundle.getBundle("label", locale);
        String xm = bundle.getString("xm");
        String gb = bundle.getString("gb");
        //防止中文乱码
        String xmm = new String(xm.getBytes("iso8859-1"), "utf-8");
        String gbb = new String(gb.getBytes("iso8859-1"), "utf-8");
        System.out.println(xmm+"
"+gbb); 
  }
}

4、结果:

姓名
国家地区
原文地址:https://www.cnblogs.com/nastu/p/15340095.html