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

the LivinGrimoire Artificial General Intelligence software design pattern forum

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
power_settings_newLogin to reply