- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
Latest commit
41 lines (33 loc) · 869 Bytes
/
Copy pathSolution.java
File metadata and controls
41 lines (33 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
importjava.lang.reflect.Method;
importjava.util.ArrayList;
importjava.util.Collections;
classStudent {
privateStringname;
privateStringid;
privateStringemail;
publicStringgetName() {
returnname;
}
publicvoidsetId(Stringid) {
this.id = id;
}
publicvoidsetEmail(Stringemail) {
this.email = email;
}
publicvoidanothermethod() {
}
}
publicclassSolution {
publicstaticvoidmain(String[] args) {
Classstudent = Student.class;
Method[] methods = student.getDeclaredMethods();
ArrayList<String> methodList = newArrayList<>();
for (Methodm : methods) {
methodList.add(m.getName());
}
Collections.sort(methodList);
for (Stringname : methodList) {
System.out.println(name);
}
}
}