title: How to assign value for a class array object?
body: <p>I am modifying a program, and it has <code>Class[] paramTypes</code> to store the input type. Then my question is how can I assign value for each cell of the array?
  I can do this <code>paramTypes = new Class[]{int.class,double.class,String.class}</code> to assign for the paramTypes, but when I try to assign each cell in for loop like <code>paramTypes[i] = int.class</code>, it shows NullPointerException. So how shoud I do this in for loop?</p>
  
  <p>This is the method:</p>
  
  <pre><code>    public MethodCall(String className,
          String methodName,
          Class[] paramTypes,
          Object[] params) {
      this.className = className;
      this.methodName = methodName;
      this.paramTypes = paramTypes;
      this.params = params;
  }
  </code></pre>
  
  <p>This is instance:</p>
  
  <pre><code>MethodCall methodCall = new MethodCall("Foo", "bar", new Class[]{int.class,double.class},new Object[]{new Integer(10), new Double(123.0)});
  </code></pre>