Unable to call interface methods through proxy object
<pre><code>import java.lang.reflect.*;
import java.util.*;
public class proxy {
    public static void main(String[] args) {
        String s ="Happy";
        InvocationHandler handler = new Handler(s);
        Class[] interfaces = s.getClass().getInterfaces();
        Object myproxy = Proxy.newProxyInstance(null,interfaces,handler);
        System.out.println(myproxy.compareTo("hoppu"));
    }
}

class Handler implements InvocationHandler {
    public Handler(Object t) {
        target = t;
    }
    public Object invoke(Object proxy,Method m,Object[] args) throws Throwable {
        System.out.println(m.getName());
        return m.invoke(target,args);
    }
    private Object target;
}
</code></pre>

<p>Proxy object can call the interfaces as it implements them.I am getting this error when i am compiling this code.</p>

<pre><code>proxy.java:19: cannot find symbol
symbol  : method compareTo(java.lang.String)
location: class java.lang.Object
    System.out.println(proxy.compareTo("hoppu"));
                            ^
1 error
</code></pre>

<p>I also tried with Integer ...same error.</p>
