system.setproperty
时间: 2023-11-19 07:06:58 浏览: 43
System.setProperty() is a method in Java that allows you to set a system property. A system property is a key-value pair that is stored in the system's properties table.
Syntax:
```java
public static String setProperty(String key, String value)
```
Parameters:
- key: a string representing the name of the system property.
- value: a string representing the value of the system property.
Example:
```java
System.setProperty("my.property", "Hello, World!");
```
In this example, we are setting a system property with the key "my.property" and the value "Hello, World!". This system property can then be accessed using the getProperty() method:
```java
String myProperty = System.getProperty("my.property");
System.out.println(myProperty); // Output: "Hello, World!"
```