Hi, I was wondering if anone here could help me out a bit with my Reflection problem. My problem is that when I try to find the methods
inside a class, not only do I get its methods, but all of its inherited methods or something like that. So if I ran the below code (Example being a made up class with a couple of methods):
Class getclass = Class.forName(Example);
Object a[] = getclass.getMethods();
for (int i = 0; i < a.length; i++) {
System.out.println (a[i]);
}
I'd get the first two output as:
public int Example.add(int,int)
public void Example.output()
then the rest would be:
public native int java.lang.Object.hashCode()
public final native java.lang.Class java.lang.Object.getClass()
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public boolean java.lang.Object.equals(java.lang.Object)
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()
public java.lang.String java.lang.Object.toString()
Which I don't really want to be getting. Is there anyway I could make it so that getmethods() just gets the primary methods? Also, just a sidenote, what's a Field?