title: getDeclaredMethod doesn't work, NoSuchMethodException
body: <p>I've been trying to use <code>Reflection</code> in Java, but it doesn't end up pretty well. Here's my code: </p>
  
  <pre><code>public class ReflectionTest {
      public static void main(String[] args) {
          ReflectionTest test = new ReflectionTest();
          try {
              Method m = test.getClass().getDeclaredMethod("Test");
              m.invoke(test.getClass(), "Cool story bro");
          } catch (NoSuchMethodException | SecurityException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IllegalAccessException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IllegalArgumentException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (InvocationTargetException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  
      public void Test(String someawesometext) {
          System.out.println(someawesometext);
      }
  }
  </code></pre>
  
  <p>I just get the <code>java.lang.NoSuchMethodException</code> error, and I've tried pretty much everything. 
  Like using <code>getMethod</code> instead of <code>getDeclaredMethod</code>, add <code>test.getClass()</code> after <code>"Test"</code> in <code>getDeclaredMethod</code> and more. </p>
  
  <p>Here's the stack trace:</p>
  
  <pre><code>java.lang.NoSuchMethodException: ReflectionTest.Test()
  at java.lang.Class.getDeclaredMethod(Unknown Source)
  at ReflectionTest.main(ReflectionTest.java:10)
  </code></pre>
  
  <p>I have been Googling for many days now but with no luck. So I does anyone know how I'm supposed to fix this?</p>