Retrieve Constructor Information of class using Java Reflection APIs

In order to retrieve Constructor information, just create object of class and call
getConstructors() api.

Java Program to retrieve Constructor Information using Java Reflection API :

Constructor[] constructor = originalClassObj.getConstructors();
System.out.println("Constructor used - ");
for (int i = 0; i < constructor.length; i++) {
    System.out.println(constructor[i].getName());
}


No comments:

Post a Comment