title: In Java how instance of and type cast(i.e (ClassName)) works on proxy object?
body: <p>Java generates a proxy class for a given interface and provides the instance of the proxy class. But when we type cast the proxy object to our specific Object, how java handles this internally? Is this treated as special scenario?</p>
  
  <p>For example I have class <code>OriginalClass</code> and it implements <code>OriginalInterface</code>, when I create proxy object by passing <code>OriginalInterface</code> interface Java created proxy class <code>ProxyClass</code> using methods in the provided interface and provides object of this class(i.e. <code>ProxyClass</code>). If my understanding is correct then can you please answer following queries</p>
  
  <ol>
  <li>When I type cast object of <code>ProxyClass</code> to my class <code>OriginalClass</code> this works, but how Java is allowing this? Same in case of instace of?</li>
  <li>As my knowledge Java creates a proxy class only with the methods, but what happen when I try to access attributes on this object?</li>
  <li>Only interface methods are getting implemented in proxy, but what happens when I try to access a method which not in interface and only mentioned in the class?</li>
  </ol>
  
  <p>Thanks,
  Student</p>