title: getConstructor with no parameters
body: <p>I can't seem to use <code>getConstructor</code> for constructors with no parameters.</p>
  
  <p>I keep getting the following exception:</p>
  
  <pre><code>java.lang.NoSuchMethodException: classname.&lt;init&gt;()
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>interface InfoInterface {
      String getClassName();
      String getMethodName();
      String getArgument();
  }
  
  class asa implements InfoInterface {
      @Override
      public String getClassName() {
          return ("jeden");
      }
      @Override
      public String getMethodName() {
          return ("metoda");
      }
      @Override
      public String getArgument() {
          return ("krzyk");
      }
  }
  
  class Jeden {
      Jeden() {
          System.out.println("konstruktor");
      }
  
      public void Metoda(String s) {
          System.out.println(s);
      }
  }
  
  class Start {
      public static void main(String[] argv) {
          if (argv.length == 0) {
              System.err.println("Uzycie programu: java Start nazwa_klasy nazwa_klasy2...");
              return;
          }
  
          try {
              for (int x = 0; x &lt; argv.length; x++) {
                  Class&lt;?&gt; c = Class.forName(argv[x]);
                  InfoInterface d = (InfoInterface) c.newInstance();
                  String klasa = d.getClassName();
                  String metoda = d.getMethodName();
                  String argument = d.getArgument();
  
                  Class&lt;?&gt; o = Class.forName(klasa);
                  // o.newInstance();
  
                  Constructor&lt;?&gt; oCon = o.getConstructor();
                  System.out.println("ASD");
                  Class&lt;?&gt; p = (Class&lt;?&gt;) oCon.newInstance();
              }
          } catch (Exception e) {
              System.out.println(e);
          }
  
      }
  }
  </code></pre>
  
  <p><code>o.newInstance();</code> prints <code>"konstruktor"</code> without problems.</p>