How to find the number of declared functions in a Java program
<p>I am doing project in Core Java which identifies the similarity between two files, in that one part is to identify the declared functions length. I have tried the following code to find the declared methods in a given class.</p>

<pre><code>import java.lang.reflect.*;
import java.io.*;
import java.lang.String.*;
public class Method1 {
    private int f1(
    Object p, int x) throws NullPointerException
    {
        if (p == null)
        throw new NullPointerException();
        return x;
    }

    public static void main(String args[])throws Exception
    {
        try {
            Class cls = Class.forName("Anu");
            int a;
            Method methlist[]= cls.getDeclaredMethods();
            for (int i = 0; i &amp;lt; methlist.length;i++) {
                Method m = methlist[i];
                System.out.println(methlist[i]);
                System.out.println("name = " + (m.getName()).length());

            }
        }
        catch (Throwable e) {
            System.err.println(e);
        }
    }
} 
</code></pre>

<p>But i have to find all the classes for a program. Shall i give input as a program since have to identify the declared methods in each class. Secondary it is working only if the given class is compiled, ie class file exist for given class.
Can any one help me for identifying the declared methods in the given program.</p>

<p>And i have to identify the comment lines in the program, please help me for that too.</p>
