Java tutorial
//package com.java2s; import java.lang.reflect.Field; public class Main { public static Object getFieldValue(Class<?> fieldClass, String fieldName, Object instance) { try { Field e = fieldClass.getDeclaredField(fieldName); e.setAccessible(true); return e.get(instance); } catch (Exception var4) { var4.printStackTrace(); return null; } } }