Saturday, 10 June 2017

Java Tutorial: System class in java [How to get the system property indicated by the specified key] ~ foundjava


Click here to watch in Youtube :

https://www.youtube.com/watch?v=QLcKjdm0Umc&list=UUhwKlOVR041tngjerWxVccw

PropertiesDemo.java

/*
 * public static String getProperty(String key)
 *
 * Parameters:
 * ----------
 *
 * key - the name of the system property.
 */

public class PropertiesDemo
{

    public static void main(String[] args)
    {
        /*
         * Gets the system property indicated by the
         * specified key.
         */
        String value = System.getProperty("os.name");
        System.out.println("value = " + value);

        String value1 = System.getProperty("a.b");
        System.out.println("value1 = " + value1);

    }
}
Output
value = Windows 7
value1 = null

Click the below link to download the code:

CLICK HERE

No comments:

Post a Comment