Tuesday, 22 October 2013

How can we make a Empty interface ?

we can make an empty interface that to call it and make that configuration to the Compiler to take care about how to deal with the class that implement that interface.





We name the Interface that haven't method a Marker Interface , or Tag Interface.

Basically , we make it to mark the class that implement it and make the compiler take care about it. Other code can then use reflection to see if your objects are meant to be used as messages and act accordingly.


Example: Serializabe interface has no methods. 

No comments:

Post a Comment