battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programmers allianceLog in

battle programming a forum for elite programmers with extreme will power to sharpen their skills

descriptionjava print list of class methodes Emptyjava print list of class methodes

more_horiz

Code:


Class tClass = aEye.getClass();
Method[] methods = tClass.getMethods();
for (int i = 0; i < methods.length; i++) {
   // filter out super class methodes :
   if (!methods[i].toString().contains("Object")) {
      System.out.println("public method: " + methods[i]);
   }
}



replace aEye with any other class instance
morph

descriptionjava print list of class methodes EmptyRe: java print list of class methodes

more_horiz
print all class methods private and public :

Code:

Class tClass = aEye.getClass();
      Method[] methods = tClass.getDeclaredMethods();
      for (int i = 0; i < methods.length; i++) {
         // filter out super class methodes :
         if (!methods[i].toString().contains("Object")) {
            System.out.println("method: " + methods[i]);
         }
      }


chobit
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum