Tuesday, November 29, 2011

When can an object reference be cast to an interface reference?

An object reference be cast to an interface reference when the object implements the referenced interface.:an object reference is cast into interface reference when we the class is implementing that interface .this is done specially in the case of event handeling when we pass the refernce of our class ,which is caught in reference variable of the interface.this is also done when jvm creates the object ,for example in the case of threads which implements runnable
Category:Java Interview Questions

No comments:

Post a Comment