查看文件编码类型是不是 utf-8
如果不是 修改为uft-8
然后就设置读取时的编码类型
InputStream resourceAsStream = equalsDemo.class.getClassLoader().getResourceAsStream("test.properties");
Properties pro = new Properties();
pro.load(new InputStreamReader(resourceAsStream,"UTF-8"));
String name = pro.getProperty("name");
System.out.println(name);
输出
原创文章,作者:sunnyman218,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/245366.html