public Object newProxyInstance(Class<?> interfaceClass,String implClassName) throws Exception {
  MyInvocationHandler handler=new MyInvocationHandler(implClassName);
  return Proxy.newProxyInstance(interfaceClass.getClassLoader(),new Class[]{interfaceClass},handler);
}

public Object newProxyInstance ( Class < ? > interfaceClass , String implClassName ) throws Exception { MyInvocationHandler handler = new MyInvocationHandler ( implClassName ) ; return Proxy . newProxyInstance ( interfaceClass . getClassLoader ( ) , new Class [ ] { interfaceClass } , handler ) ; }
create a proxy instance that implements the specified access interface and delegates incoming invocations to the specified dynamic implementation . the dynamic implementation may change at run - time , and the proxy will always delegates to the up - to - date implementation .
