Convert String to code in Java
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/160970/how-do-i-invoke-a-java-method-when-given-the-method-name-as-a-string">How do I invoke a java method when given the method name as a string?</a><br>
  <a href="http://stackoverflow.com/questions/2946338/how-do-i-programmatically-compile-and-instantiate-a-java-class">How do I programmatically compile and instantiate a Java class?</a>  </p>
</blockquote>



<p>I have a function:</p>

<pre><code>fun1() {
  System.out.print("hello");
}
</code></pre>

<p>I want to read a string from either the user or a file, and if the string <code>"fun1()"</code> appears, I'd call fun1.</p>

<p>I don't want to do this with a switch statement, because I have a lot of functions.</p>

<p>There is any way to call a function using strings?</p>
