import java.lang.reflect.Array;
public class ReflectionTest {
public static void main(String[] args) {
try {
Example obj = new Example();
java.lang.reflect.Field[] F1 = obj.getClass().getDeclaredFields();
String Name = new String();
for (int i = 0; i < F1.length; i++) {
System.out.println(F1[i].getType());
System.out.println(F1[i].getName());
Name = F1[i].getName();
}
//Assume that you have known that "F1[1]" is the char array
int length = Array.getLength(F1[1].get(obj));
System.out.println("The length of c1 is: " + length);
} catch (Exception e) {
System.out.println("err occur");
}
}
}
class Example {
int I1 = 3;
char c1[] = new char[10];
}