• Propertiesが便利だと知る。
import java.util.*;
import java.io.*;

class GetProperty {
    public static void main(String args[]) {
        try {
            /* プロパティファイルのパスを渡して読み込む */
            Properties prop = new Properties();
            prop.load(new FileInputStream("resdir/myres.properties"));

            String value = prop.getProperty("key1");
            System.out.println(value);

            prop.setProperty("key3","value3");

            /* 更新後のプロパティを別のファイルに保存する */
            prop.store(new FileOutputStream("resdir/myres_stored.properties"),"Stored by GetProperty");
        }
        catch (Exception ex) {
            ex.printStackTrace(System.err);
        }
    }
}