JAVA中 Properties结合io字符流存取
作者:互联网
package Iodemo; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Properties; import java.util.Set; public class PropertiesDemo { public static void main(String[] args) throws IOException { writes(); reads(); } private static void reads() throws IOException { FileReader fileReader = new FileReader("1.txt"); Properties pp = new Properties(); pp.load(fileReader); fileReader.close(); System.out.println(pp); } private static void writes() throws IOException { Properties pp = new Properties(); pp.setProperty("aaa","111"); pp.setProperty("bbb","222"); FileWriter f = new FileWriter("1.txt"); pp.store(f,null); f.close(); } }
标签:pp,java,IOException,io,import,JAVA,Properties 来源: https://www.cnblogs.com/phpwyl/p/16103286.html