Java: how to specity a type for a function parameter without specifying a full type
<p>Suppose i have a interface like this,</p>

<pre><code>interface MyIntf{
  void generate();
}
</code></pre>

<p>and a method like below</p>

<pre><code>void run(Myintf x) {
  x.generate();
}
</code></pre>

<p>I could call run() with an object of a class which implements MyIntf.</p>

<p>but is it possible in Java to declare run without an explicit name for the interface.</p>

<p>i.e. can i specify run() like this?</p>

<pre><code>void run("Some object which has a method called 'void generate()'" x){
  x.generate();
}
</code></pre>

<p>and run() can be called with an object of any class which has a method called</p>

<pre><code>void generate();
</code></pre>

<p>I am new to Java, so please forgive me if the question is too dumb or is already asked.</p>

<p>Regards,
VImal</p>
