System.getProperties() in Java

System.getProperties(): This method is available in java.lang.System class of Java.

Syntax:

Properties java.lang.System.getProperties()

This method determines the current system properties. First, if there is a security manager, its checkPropertiesAccess method is called with no arguments.

Note: This may result in a security exception.

Parameters: NA

Returns: the system properties.

Throws:

1. SecurityException - if a security manager exists and its checkPropertiesAccess method doesn't allow access to the system properties.

Approach

Java

public class SystemgetProperties {
    public static void main(String[] args) {

        System.out.println("Number of system properties are " +
 System.getProperties().size());
    }
}

Output:

Number of system properties are 48


No comments:

Post a Comment