Controlled interface Implementation-Collection of common programming errors
In Serialization, the class which we want to be serialized has to implement the Serializable interface, otherwise a NotSerializableException is thrown. There are many other examples like that in the various features of Java. Now I just want to know how to bring in such control in custom classes and interfaces. I have an interface called Agent. There can be many different types of Agents, all of them must implement the Agent interface. I also have a class called Node. Nodes create Agents. Now how to bring in control in such a situation, such that an agent always much implement Agent interface, otherwise an exception will be thrown. I might sound a bit vague, but if someone can provide me with the general idea, then I can provide further details if necessary.