title: Java reflection, add volatile modifier to private static field
body: <p>It's possible to add the volatile modifier to a field that is private and static?</p>
  
  <p>Example Code</p>
  
  <pre><code>// I don't know when test is initalized
  public class Test {
      private static String secretString;
  
      public Test() {
          secretString = "random";
      }
  }
  
  public class ReflectionTest extends Thread {
      public void run() {
          Class&lt;?&gt; testClass = Class.forName("Test");
          Field testField = testClass.getDeclaredField("secretString");
  
          while (testField.get(null) == null) {
              // Sleep, i don't know when test is initalized
              // When it'is i need the String value
              // But this loop never end.
          }
      }
  }
  </code></pre>
  
  <p>I think that if i set the field volatile the loop end
  without any problem</p>