package tst.socket.properties; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class TestProperties { public static void main(String[] args) throws Exception { new TestProperties().testProperties(); } public void testProperties() throws IOException{ Properties properties=new Properties(); InputStream ips1 = this.getClass().getClassLoader().getResourceAsStream("tst/socket/properties/info.properties"); properties.load(ips1); String count=properties.getProperty("线程"); System.out.println(count); File file=new File("test.info.properties"); if(!file.exists()){ file.createNewFile(); } properties.store(new FileOutputStream(file), "注释"); } }
本文出自 “matengbing” 博客,请务必保留此出处http://matengbing.blog.51cto.com/11395502/1878508
原文:http://matengbing.blog.51cto.com/11395502/1878508