zoukankan      html  css  js  c++  java
  • java_Properties写入文件

    package ming;
    
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;
    
    public class PropertiesTest {
    
    	/**
    	 * @param args
    	 * @throws IOException 
    	 * @throws FileNotFoundException 
    	 */
    	public static void main(String[] args) throws FileNotFoundException, IOException {
    		// TODO Auto-generated method stub
    		Properties props = new Properties();
    		//向Properties添加属性
    		props.setProperty("username", "abc");
    		props.setProperty("password", "123");
    		//保存到a.ini文件中
    		props.store(new FileOutputStream("a.ini"), "comment line");
    		//追加数据
    		Properties props2 = new Properties();
    		props2.setProperty("gender", "male");
    		props2.load(new FileInputStream("a.ini"));
    		System.out.println(props2);
    		
    	}
    
    }
    


  • 相关阅读:
    虚树
    最小树形图
    分块
    斜率优化
    单调队列优化DP
    树套树
    2-SAT
    莫队
    单调队列
    单调栈
  • 原文地址:https://www.cnblogs.com/MarchThree/p/3720464.html
Copyright © 2011-2022 走看看