forked from EngFlow/example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
21 lines (17 loc) · 728 Bytes
/
Copy pathMain.java
File metadata and controls
21 lines (17 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.engflow.binaryinput;
import java.lang.reflect.InvocationTargetException;
public class Main {
public static void main(String[] args) {
try {
// args[0] is the number of files to read
int numFiles = Integer.parseInt(args[0]);
// Load and run the greetNum method from each class
for(int i = 1; i <= numFiles; i++){
Class<?> clazz = Class.forName("com.engflow.binaryinput.Hello" + i);
clazz.getMethod("greetNum").invoke(null);
}
} catch (ClassNotFoundException | InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
}