This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have Created my Interface and given four methods inside the Interface.I compiled my Interface and given the compiled interface file to my Friend. How do my friend know that what are the methods inside the Interface, so that he can implement the Interface in his class?
Well , it depends on the interface designer himself. 1)The first way is to provide some sort of documentation to the person who wants to implement that interface.The best way is to use the javadoc tool available from Sun. 2)The second way would be to implement the interface and compile the class.From the errors the compiler throws , which could be of the form "class XYZ shoulde be ddeclared abstract because it does not implement method ABC()..." your friend will come to know abot the methods u have provided in that interface. Any other suggestions are welcome. ------------------ Come on in !! Drinks are on the house in the Big Moose Saloon !!
Udayan Naik<BR>Sun Certified Programmer for the Java 2 Platform
It is the responsibility of the interface developer to publish it! What good an interface is, if the publisher doesn't tell what it is for? Also note that, publishing an interface doesn't mean just telling the method names and parameters. You also have to tell the semantics, use and pretty much everything that helps a user to implement that interface 'resposibly'. Best example is JDBC, all the classes are actually interfaces. They come with complete documentation of what they do. Vendors who implement those interfaces must stick to the interfaces' meaning/use.
Of course, you can run javap on the class file and find all the methods/fields. HTH, Paul.
------------------ Get Certified, Guaranteed! (Now Revised for the new Pattern) www.enthuware.com/jqplus