title: Java invoke method using reflection
body: <p>I am trying to invoke a method using reflection. </p>
  
  <p>The method I am invoking is not static and in the same class I am invoking it from. </p>
  
  <p>A simplified version of my code:</p>
  
  <pre><code>public class Test {
    public static void main(String[] args) {
      Test instance = new Test();
      if (args.length &gt; 0) {
        instance.doWork(args[0]);
      }
    }
  
    private void doWork(String methodName) {
      Method method;
  
      try {
        method = this.getClass().getMethod(methodName);
        method.invoke(this);
      } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        [...]
      }
    }
  
    private void MethodOne() { ... };
    private void MethodTwo() { ... };
    [...]
    private void MethodTwenty() { ... };
  }
  </code></pre>
  
  <p>What I am getting is a <code>java.lang.NoSuchMethodException: correct.package.and.class.MethodTwo()</code> despite the package / class / method existing. </p>
  
  <p>Can someone tell me what I am doing wrong?</p>