I have the following class:
public class Test { public static int a = 0; public int b = 1; }
Is it possible to use reflection to ge
You can do it like this:
Field[] declaredFields = Test.class.getDeclaredFields(); List staticFields = new ArrayList(); for (Field field : declaredFields) { if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) { staticFields.add(field); } }