import java.util.*;
/********************************************************
 * Get all System properties name/value pairs
*********************************************************/

public class SystemProperties
{
    public static void main (String[] args)
    {
        String user = System.getProperty("user.name");
        System.out.println("You are: " + user + "\n");

        Properties props = System.getProperties();              //get all the System properties
    
        Enumeration list = props.propertyNames();               //get all the prop names as an Enumeration

        System.out.printf("%-30s %s \n", "   SYSTEM    ", "    SYSTEM    ");
        System.out.printf("%-30s %s \n", "PROPERTY NAME", "PROPERTY VALUE");
        System.out.printf("%-30s %s \n", "-------------", "--------------");

        while(list.hasMoreElements())
        {
            String propName  = (String) list.nextElement();             //get the property name

            String propValue = (String) props.getProperty(propName);    //get the property value

            System.out.printf("%-30s %s \n", propName, propValue);
        }
    }
}