Hi all,
I really don't know this is the right place to post this question,
i hope my question though fundamental, may not be that basic.

My question is: Java Interfaces, what is the proper way of using them? Conceptually, everybody i spoke to, says it supports multiple inheritance. And they just define methods, leaving upon the class that implement it, the functionality(behavior) of the methods. But although every word of this argument is true, I have also noticed that Interfaces are also used to flag. Means, certain funcationality of a particular class is only available, if a specific interfaces(s) is/are implemented. Servlets are good examples. So servlet cannot be servlet unless a particular interface is implemented.
Now the point is that, if I've to put the same behaviour in my own
program, can i do it? Or, this flagging is inbuilt inside JVM?
Can i make,
in three different packages
1) package1: Interface myInterface,
2) package2: A Class class1 with Main method,
3) package3: Another Class class2 whose functionality is available
to class1 only when interface myInterface is implemented by class1.
In such a way that when i try using class2 in class1, without
implementing myInterface, compiler gives me a message.....??
I hope i was able to explain myself. maybe i m just not thinking hard...the solution is just around the corner.
rgds to all
Aashu