public class AppTest { private NodeClass nodeClass; public static String hehe = "hehe"; public String xixi = "xixi"; public void test() { Field[] fields = AppTest.class.getDeclaredFields(); try { for (Field field : fields) { field.setAccessible(true); if(field.getType().toString().endsWith("java.lang.String") && Modifier.isStatic(field.getModifiers())) System.out.println(field.getName() + " , " + field.get(AppTest.class)); } } catch (Exception e) { e.printStackTrace(); } } }