DISCLAIMER: This is only part of a homework assignment I am currently doing
Say I have a method array which contains all of my declared methods
Method methodList[] = classGetter.getDeclaredMethods();
in which classGetter simply gets what class I want to get the methods of. Is there a way to sort this array by what kind of modifier is associated with the method? I see that when I print out the modifier using
for(Method m: methodList){
System.out.println(m.getModifiers());
}
it returns integer values. I tried to sort using the Arrays.sort method but I got error exceptions. Any Pointers?
Aucun commentaire:
Enregistrer un commentaire