java.lang.Class.getDeclaredConstructors()


java.lang.Class.getDeclaredConstructors()

package com.codingdict;



import java.lang.reflect.*;



public class ClassDemo {



   public static void main(String[] args) {



      ClassDemo cls = new ClassDemo();

      Class c = cls.getClass();



      // constructors

      Constructor[] ct = c.getDeclaredConstructors();

      for(int i = 0; i < ct.length; i++) {

         System.out.println("Constructor found: " + ct[i].toString());

      }

   }



   private ClassDemo() {

      System.out.println("no argument constructor");

   }



   public ClassDemo(Double d, Long l) {

      this.d = d;

      this.l = l;

   }



   Double d = new Double(3.9d);

   Long l = new Long(7687);

}