Online Java Compiler By
JavaTpoint.com
import java.lang.reflect.Method; import java.lang.reflect.TypeVariable; public class ReflectMethodgetTypeParametersExample2 { public
void getMethodX(N n) { } public static void main(String args[]) { try { Class c = ReflectMethodgetTypeParametersExample2.class; Method[] mthd = c.getMethods(); for (Method m : mthd) { TypeVariable[] tp = m.getTypeParameters(); for (TypeVariable t : tp) { System.out.println("Type variable for Method Name " + m.getName() + " is " + t.getName()); } } } catch (Exception e) { // print Exception Messgae if // any exception occured in program e.printStackTrace(); } } }
Output