System.setProperty or public static variable?
<p>I understand that <code>System.setProperty(“key”,”value”)</code> and <code>System.getProperty(“key”)</code> are used to hold and retrieve system properties and user-defined properties. The values set can be accessed everywhere within the application. </p>

<p>Also, I am aware that when a variable is declared <code>public</code> and <code>static</code>, it becomes a constant and is available everywhere within the application. </p>

<p>I would like to know of the 2 which is advantageous and a better option. One aspect I could think of is System.setProperty is useful when we want to retrieve a value in an xml file[using ${key}]. The same can not be achieved using public static variable. </p>

<p><strong>My questions are</strong></p>

<ol>
<li>Are there any other benefits? </li>
<li>Which one is a better option?</li>
<li>On what scenarios should one go with System.setProperty/getProperty and public static variable? </li>
</ol>

<p>Thanks in advance.</p>