0

Assume there is a class:

public static final class A {
 public static final String s1 = "String 1";
 public static final String s_random = "Another random String";

 public A() {throw new SomeException("NOT TO BE CREATED! For Value Access only!");}
}

Then I want to check whether this class has "Another random String" defined inside the class. It can be a method like (it could be in the other form):

public boolean check(String s, Class className) {
 // Something
}

How can I achieve that? Given that all the names of the String fields in that class are unknown.

ONLYA
  • 3
  • 6

0 Answers0