Created
May 28, 2017 16:26
-
-
Save ldclakmal/4e78d54a439e86013c8650dd49e65372 to your computer and use it in GitHub Desktop.
Get the names of the static variables of a class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void getVariableNames() { | |
Field[] fields = MyClass.class.getDeclaredFields(); | |
for (Field f : fields) { | |
if (Modifier.isStatic(f.getModifiers())) { | |
System.out.println(f.getName()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment