Call a method of class using object of some other class in java
<pre><code>List CreateNewStatements(ForLoop L)
{
    List stmts = new ArrayList();
    FlatIterator iter = new FlatIterator(L.getBody());

    Traversable t1 = null;

    LoopUnroll l = new LoopUnroll(t1);

    while(iter.hasNext())
    {
        stmts.add(iter.next().clone());
    }
    return stmts;
}
</code></pre>

<p>The above code is giving the error as "The method clone() from the type <i>Object</i> is not visible".</p>

<p>In the above code, iter.next() returns a statement(Eg. fx[i] = fx[i] + x) of type <i>Object</i>(built in into java library) using which I want to call the method clone(). The above code is written in a class <i>LoopUnroll</i> and clone() is a method defined in the class <i>Statement</i>.</p>
