Java
  Home arrow Java arrow Page 2 - Using Javadoc
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Using Javadoc
By: Kulvir Singh Bhogal & Kwang Sik Kang
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 38
    2004-01-07

    Table of Contents:
  • Using Javadoc
  • Java Documentation Comments
  • A Sample Class with Some Comments
  • Taking a Peek at the Automagically Generated Documentation
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Javadoc - Java Documentation Comments


    (Page 2 of 5 )

    Java provides a documentation comment taking the format found in Listing 1. Javadoc comments are used to describe classes, variables, objects, and methods.  A Javadoc comment is placed above the element it is documenting. 

    Listing 1: JavaDoc Comment

    Line 1: /** Description of the element being documented
    Line 2: * @tagA Description of tagA
    Line 3: * @tagB Description of tagB
    Line 4: */

    There are a few elements to notice in the snippet above. The first is the beginning of the Java documentation comment begins with /** (Line 1) and ends with */ (Line 4).

    Next, as the code snippet states, the first part of the comment should describe the documented element (Line 1). The upcoming exercise will illustrate the Javadoc tool’s interpretation of this description.

    Finally, note the presence of tags in the code snippet (Lines 2 & 3). There are a number of predefined tags that can be used to describe a given element.  Some of these include:

    @author text – the element’s author (only used for Java classes)

    @version text – the element’s version number (only used for Java classes)

    @param name description – describes the parameters of a method accompanied by a description (used for Java methods)

    @return text – describes the value returned by a method (used for Java methods)

    @exception exceptionClassName description – states the exceptions that a given method throws with an associated description.

    @deprecated – used to state that the element being described has been deprecated.  When you use this tag, a deprecation warning will be issued when you compile a Java program using the element in question.

    @since text – describes the product version when the element was added to the API specification

    Note that there are a number of other tags that we have not discussed.  A good resource to learn more about all the tags in your Javadoc arsenal is the How to Write Doc Comments for the Javadoc Tool reference.

    More Java Articles
    More By Kulvir S. Bhogal


     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT