java - 如何获取在java类的方法中声明的变量名称?
例如:
public class A {
String x;
public void xyz(){
int i;
String z = null;
//some code here
}
Method[] methods = A.class.getDeclaredMethods();
for (Method q = methods){
//some code here to get the variables declared inside method (i.e q)
}
}
我怎样才能做到这一点?
提前致谢..