I'm trying to get a parameter type how do I do that, I have this:
java Code:import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
public class Hello {
public Hello() {
}
public static void H(int j) {
System.out.println("Hi");
}
public static int G() {
System.out.println("H g i");
return 6;
}
public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Hello g = new Hello();
Method[] methods = g.getClass().getMethods();
for(int i = 0;i < methods.length; i++) {
Parameter[] a = methods[i].getParameters();
Class <?> unknown = a[i].getType();
System.out.println(unknown.getName());
}
}
}




Reply With Quote

