title: Java reflection API: Invoking a method without parameters
body: <p>The method I want to invoke (I know it's public but I need to use reflection):</p>
  
  <pre><code>public byte[] myMethod()  
  </code></pre>
  
  <p>I get the <code>Method</code> object like this and <code>m</code> contains <code>myMethod()</code> (I checked with the debugger)</p>
  
  <pre><code>Method m = Class.forName(MyClass.class.getName()).getDeclaredMethod("myMethod");
  </code></pre>
  
  <p>Finally I need to invoke m and pass the result to an object:</p>
  
  <pre><code>byte[] myBytes = null;
  m.invoke(myBytes);
  </code></pre>
  
  <p>No exception is thrown but <code>myBytes</code> stays null... I also tried the following without more success:</p>
  
  <pre><code>m.invoke(myBytes, (Object[])null);
  </code></pre>
  
  <p>How can I get the result of the invocation to myBytes?</p>