package J20250728;

import java.util.Properties;
import java.util.Set;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo05_Properties
 * @description
 * @create 2025/7/28
 */
public class Demo05_Properties {
    public static void main(String[] args) {
        Properties prop=new Properties();
        //使用Properties特有的方法添加属性键值对(添加元素)
        prop.setProperty("name","张三");
        prop.setProperty("age","25");
        prop.setProperty("sex","男");
        prop.setProperty("username","zhangsan");
        prop.setProperty("password","123456");

        Set<String> names = prop.stringPropertyNames();
        for (String key:names){
            String value = prop.getProperty(key);
            System.out.println(key+"->"+value);
        }

    }
}
