Online Java Compiler By
JavaTpoint.com
import java.lang.reflect.*; public class ClassgetDeclaredConstructorsExample1 { public static void main(String[] args) { ClassgetDeclaredConstructorsExample1 obj = new ClassgetDeclaredConstructorsExample1(); Class cls = obj.getClass(); Constructor[] cnstrct = cls.getDeclaredConstructors(); for(int i = 0; i < cnstrct.length; i++) { System.out.println("Constructor : " +(i+1)+ " = " + cnstrct[i].toString()); } } private ClassgetDeclaredConstructorsExample1() { System.out.println("no argument constructor"); } public ClassgetDeclaredConstructorsExample1(Double dbl, Long lng) { this.dbl = dbl; this.lng = lng; } Double dbl = new Double(3.9d); Long lng = new Long(7687); }
Output