public static void main(String[] args) {
Properties p = new Properties();
try {
p.load(new FileReader("src//main//resources//a.properties"));
Enumeration en = p.propertyNames();
while (en.hasMoreElements()){
String str = (String)en.nextElement();
System.out.println(str+"--"+p.getProperty(str));
}
} catch (Exception e) {
e.printStackTrace();
}
}
Properties文件中的内容格式有下面三种写法
1=1
2:1
3 1