title: How to get the variables name declared within a method in java
body: <p>How to get the variables name declared within a method in java class? </p>
  
  <p>for eg:</p>
  
  <pre><code>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)
  
    }
  }
  </code></pre>
  
  <p>How can i do that?  </p>
  
  <p>Thanks in advance..</p>