-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHackerrankJava0060.java
More file actions
57 lines (46 loc) · 1.16 KB
/
HackerrankJava0060.java
File metadata and controls
57 lines (46 loc) · 1.16 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
public class HackerrankJava0060 {
public static void main(String[] args) {
// Java Reflection - Attributes
// https://www.hackerrank.com/challenges/java-reflection-attributes/problem?isFullScreen=true
// --- You need to update this line ---
Class student = Student01.class;
// --- You need to update this line ---
Method[] methods = student.getDeclaredMethods();
ArrayList<String> methodList = new ArrayList<>();
// --- You need to update this line ---
for (Method method : methods) {
// --- You need to update this line ---
methodList.add(method.getName());
}
Collections.sort(methodList);
for (String name : methodList) {
System.out.println(name);
}
}
}
class Student01 {
private String name;
private String id;
private String email;
public String getName() {
return name;
}
public String getId() {
return id;
}
public String getEmail() {
return email;
}
public void setName(String name) {
this.name = name;
}
public void setId(String id) {
this.id = id;
}
public void setEmail(String email) {
this.email = email;
}
}