title: How to check whether a class has a String defined by a public String field with an unknown name outside the class?
body: <p>Assume there is a class:</p>
  <pre class="lang-java prettyprint-override"><code>public static final class A {
   public static final String s1 = &quot;String 1&quot;;
   public static final String s_random = &quot;Another random String&quot;;
  
   public A() {throw new SomeException(&quot;NOT TO BE CREATED! For Value Access only!&quot;);}
  }
  </code></pre>
  <p>Then I want to check whether this class has &quot;Another random String&quot; defined inside the class. It can be a method like (it could be in the other form):</p>
  <pre class="lang-java prettyprint-override"><code>public boolean check(String s, Class className) {
   // Something
  }
  </code></pre>
  <p>How can I achieve that? Given that all the names of the String fields in that class are <strong>unknown</strong>.</p>