propertyfilecreator.java

来自「Usefull sample codes for Java. Containt 」· Java 代码 · 共 23 行

JAVA
23
字号
import java.io.*;
import java.util.*;

public class PropertyFileCreator {
    public PropertyFileCreator() {
        Properties prop = new Properties();
        prop.setProperty("username", "rcade");
        prop.setProperty("browser", "Mozilla Firefox");
        prop.setProperty("showEmail", "no");
        try {
            File propFile = new File("properties.xml");
            FileOutputStream propStream = new FileOutputStream(propFile);
            Date now = new Date();
            prop.storeToXML(propStream, "Created on " + now);
        } catch (IOException exception) {
            System.out.println("Error: " + exception.getMessage());
        }
    }
    
    public static void main(String[] arguments) {
        PropertyFileCreator pfc = new PropertyFileCreator();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?