개요[ | ]
- HR자바 Java Reflection - Attributes
Java
Copy
public class Solution {
public static void main(String[] args){
Class student = Student.class;
Method[] methods = student.getDeclaredMethods();
ArrayList<String> methodList = new ArrayList<>();
for(Method method: methods){
methodList.add(method.getName());
}
Collections.sort(methodList);
for(String name: methodList){
System.out.println(name);
}
}
}
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.