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


battle programming a forum for elite programmers with extreme will power to sharpen theire skills
 
HomeSearchRegisterLog in
 

 java print list of class methodes

Go down 
AuthorMessage
kurosen
codding
codding
kurosen

Posts : 274
Join date : 2012-04-17

java print list of class methodes Empty
PostSubject: java print list of class methodes   java print list of class methodes EmptyFri Apr 10, 2020 7:56 pm

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
Back to top Go down
kurosen
codding
codding
kurosen

Posts : 274
Join date : 2012-04-17

java print list of class methodes Empty
PostSubject: Re: java print list of class methodes   java print list of class methodes EmptyFri Apr 10, 2020 8:27 pm

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
Back to top Go down
 
java print list of class methodes
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: