The java.lang.Class have some useful methods for getting information about class at run time. In this example I am going to get the all field name and variable name present in particular class using reflection. import java.lang.reflect.Field; import java.lang.reflect.Method; class TestReflection { public int field1 ; public int field2 ; public void addField() { System. out .println( "Addition of two fields: " + ( field1 + field2 )); } } public class ReflectionDemo { public static void main(String[] args) { try { ...