java.lang.Class.getField() java.lang.Class.getEnumConstants() java.lang.Class.getFields() java.lang.Class.getField() package com.codingdict; import java.lang.reflect.*; public class ClassDemo { public static void main(String[] args) { ClassDemo c = new ClassDemo(); Class cls = c.getClass(); System.out.println("Field ="); try { // string field Field sField = cls.getField("string1"); System.out.println("Public field found: " + sField.toString()); } catch(NoSuchFieldException e) { System.out.println(e.toString()); } } public ClassDemo() { // no argument constructor } public ClassDemo(String string1) { this.string1 = string1; } public String string1 = "codingdict"; } java.lang.Class.getEnumConstants() java.lang.Class.getFields()