Added 25 solutions
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Author: Rodney Shaghoulian
|
||||
// Github: github.com/rshaghoulian
|
||||
// HackerRank: hackerrank.com/rshaghoulian
|
||||
|
||||
public class Solution {
|
||||
public static void main(String[] args) {
|
||||
Class student = Student.class; // uses class literal, not a function.
|
||||
Method[] methods = student.getDeclaredMethods();
|
||||
|
||||
/* Get names from Methods */
|
||||
ArrayList<String> methodNames = new ArrayList<>();
|
||||
for (Method method : methods) {
|
||||
methodNames.add(method.getName());
|
||||
}
|
||||
|
||||
/* Sort and print names */
|
||||
Collections.sort(methodNames);
|
||||
for (String name: methodNames) {
|
||||
System.out.println(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user