title: What is wrong with the following java reflect code?
body: <p>I'm trying to call URLClassLoader with reflect methods,</p>
  
  <p>I checked the documents there's a constructor declared,</p>
  
  <pre><code>URLClassLoader(URL[] urls)
  </code></pre>
  
  <p>But the following code causes a <code>wrong number of arguments</code> exception:</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  import java.lang.reflect.*;
  
  public class Foo {
      public static void main (String[] args)
      {
          try {
              Method method = URLClassLoader.class.getMethod("newInstance", URL[].class);
              URLClassLoader loader = (URLClassLoader) method.invoke (
                      new Object [] { new URL ("http://127.0.0.1/a.class") });
          } catch (Exception e) {
              e.printStackTrace ();
          }
      }
  }
  </code></pre>