Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Know Interface methods?(Very Imp.)

 
bipin_maji
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Udayan Naik
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !!
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'bipin_maji'
PROPER NAMES ARE NOW REQUIRED!!
Read this post for more details.
Ajith
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3776
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic