JAVA类中的一个参数如何抽取出来放入配置文件中

java类中有一个字符串参数,内容为IP地址,如何将其抽取出来,放到配置文件中

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Properties;
import org.apache.log4j.Logger;
public class ConfigUtil {
private static final Logger logger = Logger.getLogger(Thread
.currentThread().getStackTrace()[1].getClassName());
private static String fileName = "D:/test.properties";
private static Properties resourcesCfg = null;
static {
resourcesCfg = new Properties();
loadConfig();
}
/**
* 保存配置文件参数
* @param paramName 参数名
* @param paramValue 参数值
*/
public static void saveConfig(String paramName, String paramValue) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(java.net.URLDecoder.decode(fileName,
"utf-8"));
resourcesCfg.setProperty(paramName, paramValue);
resourcesCfg.store(fos, "Update '" + paramName + "' value");
} catch (FileNotFoundException e) {
logger.error("找不到配置文件");
} catch (UnsupportedEncodingException e) {
logger.error("读取配置文件转码错误");
} catch (IOException e) {
logger.error("读取配置文件出错.");
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
logger.error("读取配置文件出错.");
}
}
}
}

    /**
     * 加载配置信息文件.
     */
    public static void loadConfig() {
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(java.net.URLDecoder.decode(fileName, "utf-8"));
            resourcesCfg.load(fis);
        } catch (FileNotFoundException e) {
            logger.error("找不到配置文件");
        } catch (UnsupportedEncodingException e) {
            logger.error("读取配置文件转码错误");
        } catch (IOException e) {
            logger.error("读取配置文件出错.");
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    logger.error("读取配置文件出错.");
                }
            }
        }
    }

}

调用ConfigUtil.save()方法保存。字符串参数值是动态的吗?如果不是,可以先写到配置文件中,java类从配置文件里取。