As you can see from the code above, the basic requirement to implement a proxy is to implement only one interface between the real object and the proxy at the same time. In fact, the two sentences of output of our code above in the proxy are not integrated into the logical code, so we need the proxy class to handle these things.

2. Dynamic Proxy

java not only has the mode of proxy, but also creates proxy dynamically.