
setAccessible(true) String str (String) f.get(obj) (str) // Hello. the value of the represented field in object obj primitive values are wrapped in an appropriate object before being returned. Package import import import import public class IsEnumConstantExample4 Output private static final .IsEnumConstantExample4$MyEnum .IsEnumConstantExample4$MyEnum. In order to access a private field using reflection, you need to know the name of the field than by calling getDeclaredFields(String name) you will get a java. Java: Accessing private fields of superclass through reflection.
