Java program to get the list of constructors of a class
// Java program to get the list of
// constructors of a class
import java.lang.reflect.Constructor;
public class Main {
public static void main(String[] args) throws ClassNotFoundException {
Class cls = Class.forName("java.lang.Integer");
Constructor ctors[] = cls.getConstructors();
System.out.println("Constructors of Integer class: ");
for (Constructor ctor: ctors)
System.out.println(ctor);
}
}
Output
Constructors of Integer class:
public java.lang.Integer(java.lang.String) throws java.lang.NumberFormatException
public java.lang.Integer(int)