Mega Code Archive

 
Categories / Java Tutorial / Collections
 

Use store() to save the properties

import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Properties; public class MainClass {   public static void main(String args[]) throws Exception {     Properties p = new Properties();     p.load(new FileInputStream("test.txt"));     p.store(new FileOutputStream("t.txt"),"no comments");   } } //File: test.txt /* foo:bar one two three=four five  six seven eight nine ten */ foo=bar one= two= three=four five=six seven eight nine=ten