If you see source code of System Class it has following class variable
private static Properties props;
As for properties class you can think of it as a HashMap. It actually extends HashMap.
public class Properties extends Hashtable<Object,Object>
When you call
setProperty(String key, String value)
it actually does
props.setProperty(key, value);
This is just the summary(Security manager checks are also involved).
Now why did I say it is per JVM instance?
When you start a Java process a separate JVM instance is created that runs your process. Also since props is a Class variable(not an instance variable) just one copy of it will be present in the corresponding Class instance which will be set when that class is loaded. Now this is under the assumption that you do not have any of your custom class loaders in which case behavior might be different. But for simplistic scenario you System.setProperty()
and System.getProperty()
will set system properties that you can access via any class running as a part of that java process(JVM).