Get declared constructors in Java
Description
The following code shows how to get declared constructors.
Example
//from w ww . j a v a 2 s.c o m
import java.lang.reflect.Constructor;
public class Main {
public static void main(String[] argv) throws Exception {
Constructor[] cons = String.class.getDeclaredConstructors();
for (int i = 0; i < cons.length; i++) {
Class[] paramTypes = cons[i].getParameterTypes();
System.out.println(cons[i]);
}
}
}
The code above generates the following result.