Online Java Compiler By
JavaTpoint.com
//import statement import java.lang.reflect.Method; import java.lang.reflect.Type; public class ReflectMethodgetGenericReturnTypeExample1 { public static void main(String[] args) { Method[] mthd = SampleX.class.getMethods(); Type rType = mthd[0].getGenericReturnType(); System.out.println(rType); } } class SampleX { private String Field; public String getSampleField() { return Field; } public void setSampleField(String Field) { this.Field = Field; } }
Output