pass method as parameter using anonymous inner class
<p>There was an answer similar to this here:
<a href="http://stackoverflow.com/questions/4685563/how-to-pass-a-function-as-a-parameter-in-java">How to pass a function as a parameter in Java?</a></p>

<p>but the correct answer provided does not work. I have a class:</p>

<pre><code>public class randomClass {
  2 
  3         public String name;
  4         private int x;
  5         private boolean y;
  6 
  7         public randomClass(String name){
  8                 this.name = name;
  9                 setAttributes(1,true, "test");
 10                 System.out.println(x + "," + y);
 11         } 
...
 21 
 22         public int xMethod(){
 23                 return 1;
 24         }
 25 
 26         public void passMethod(){
 27                 testMethod(new Callable&lt;Integer&gt;() {
 28                                 public Integer call(){
 29                                         return xMethod();
 30                                 }
 31                 });
 32         }
 33 
 34         public void testMethod(Callable&lt;Integer&gt; myFunc){
 35 
 36         }
</code></pre>

<p>inside function passMethod im trying to pass xMethod() into testMethod, but the error I get is:</p>

<pre><code>cannot find symbol
symbol  : class Callable
</code></pre>

<p>and I'm not sure why.</p>

<p>Also, I tried using return type String for xMethod, can you pass a function with different return types then Integer?</p>
