My question similar to others but it's little bit more tricky for me I have a Class DummyData having static defined variables
- public static String Survey_1="";
- public static String Survey_2="";
- public static String Survey_3="";
So, i call them DummyData.Survey_1 and it returns whole string value. Similarly do with DummyData.Survey_2 and DummyData.Survey_3 But the problem is when i call them Dynamically its not return their value. I have a variable data which value is change dynamically like (data=Survey_1 or data=Survey_2 or data=Survey_3) I use #Reflection to get its value but failed to get its value I use methods which I'm mentioning Below help me to sort out this problem.
Field field = DummyData.class.getDeclaredField(data);
String JsonData = field.toString();
and
DummyData.class.getDeclaredField("Survey_1").toString()
but this return package name, class name and string name but not return string value. What I'm doing can some help me??