Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Properties;

public class Main {
    /**
     * Gets the String property from the properties object.
     * @param key the key of the String property
     * @param properties the properties object to get the property from
     * @return the property value, an empty string if the property doesn't exist
     */
    public static String getString(String key, Properties properties) {
        return getString(key, "", properties);
    }

    /**
     * Gets the String property from the properties object.
     * @param key the key of the String property
     * @param defaultValue the default value if the property doesn't exist
     * @param properties the properties object to get the property from
     * @return the property value, defaultValue if the property doesn't exist
     */
    public static String getString(String key, String defaultValue, Properties properties) {
        return properties.getProperty(key, defaultValue);
    }
}