package day24.demo04;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
public class Test01 {
public static void main(String[] args) throws IOException {
Properties pp = new Properties();
FileWriter fw = new FileWriter("aa.txt");
pp.put("name","echo");
pp.put("age","12");
pp.store(fw,null);
fw.close();
FileReader fr = new FileReader("aa.txt");
pp.load(fr);
fr.close();
Set<Object> keys = pp.keySet();
for (Object key : keys) {
System.out.print(key);
Object obj = pp.get(key);
System.out.println(" "+obj.toString());
}
}
} |
|