JAVADOC common ways to use help documents

Source: Internet
Author: User
Tags deprecated locale

We know there are three types of comment statements in Java:1.//used for single-line comments. 2./*...*/For multi-line annotations, from/*start, to*/end, cannot be nested. 3./**...*/is a comment statement that is unique to support the JDK tool Javadoc.exe. The Javadoc tool can read the third annotation from the Java source file and recognize some special variables (see table) in the comments, and make the class description document in HTML format. Javadoc can not only generate annotated documents for a Java source file, but also facilitate the creation of a cross-linked HTML-formatted class description document for directories and packages. Keywords that can appear in a comment begin with @: @author author name @version version identifies @parameter parameter name and its meaning @since the earliest JDK version that appearsreturnreturn value @throwsexception classes and thrown conditions @deprecated causes deprecated warnings @see Cross Reference The following is the use of Javadoc.exe C:\java>javadoc-Helpc:\java>javadoc-Help Usage:javadoc [options] [packagenames] [sourcefiles] [classnames] [@files]-overview <file>Read Overview Documentation from HTML file- PublicShow only PublicClasses and members-protectedShowprotected/ PublicClasses and members (default)- PackageShow Package/protected/ PublicClasses and members-PrivateShow All classes and members-Help Display command line options and exit-doclet <class>Generate output via alternate Doclet-docletpath <path> specify where to find DocletclassFiles-sourcepath <pathlist>specify where to find source files-classpath <pathlist> specify where to find userclassFiles-exclude <pkglist>Specify a list of packages to exclude-subpackages <subpkglist>specify subpackages to recursively load-Breakiterator Compute 1st sentence with Breakiterator-bootclasspath <pathlist> Override Location ofclassFiles loaded by the bootstrapclassLoader-source <release>provide source compatibility with specified release-extdirs <dirlist>Override location of installed extensions-verbose Output messages about what Javadoc is doing-locale <name>Locale to be used, e.g en_US or en_us_win-encoding <name>Source file Encoding name-j<flag> Pass <flag>directly to the runtime systemprovided by standard Doclet:-D <directory> Destination Directory forOutput Files-use Createclassand PackageUsage Pages-version Include @version paragraphs-author Include @author paragraphs-docfilessubdirs recursively copy doc-File subdirectories-Splitindex Split index into one file per letter-windowtitle <text> Browser window title forThe documenation-doctitle  forThe overview page-header  forEach page-footer  forEach page-bottom  forEach page-link <url> Create links to Javadoc output at <url>-linkoffline <url> <url2> Link to docs at <url> using PackageList at <url2>-excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.-group <name> <p1>:<p2>.. Group specified packages together in Overviewpage-nocomment supress Description and tags, generate only declarations.-nodeprecated do not include @deprecated information-noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.-nosince do not include @since information-nodeprecatedlist do not generate deprecated list-notree do not generateclassHierarchy-noindex do not generate index-nohelp don't generate help link-Nonavbar do not generate navigation bar-quiet Don't display status messages to screen-serialwarn Generate warning about @serial tag-tag <name>:<locations>:Specify single argument custom tags-Taglet The fully qualified name of Taglet to register-Tagletpath the path to Taglets-charset <charset> CharSet forcross-platform viewing of generated documentation.-helpfile <file>Include file, help link links to-linksource Generate Source in HTML-stylesheetfile <path>File to change style of the generated documentation-docencoding <name>Output encoding Namec:\java>Here's a look at the document generated with Javadoc (click the Watch demo link above this page) to generate the document: C:\java>Javadoc javadocdemo.javaloading source file Javadocdemo.java ... Constructing Javadoc information ... Standard Doclet version1.4. 2_03generating constant-values.html ... Building Tree forAll the packages and classes ... Building Index forAll the packages and classes ... Generating Overview-tree.html ... Generating Index-all.html ... Generating deprecated-list.html ... Building Index forAll classes ... Generating Allclasses-frame.html ... Generating Allclasses-noframe.html ... Generating index.html ... Generating packages.html ... Generating javadocdemo.html ... Javadocdemo.java:11:warning-Tag @see: Reference not found:javax.swing.JappletGenerating serialized-form.html ... Generating Package-list ... Generating Help-doc.html ... Generating Stylesheet.css ...1Warningc:\java>attached source file:Importjava.applet.*;Importjava.awt.*;Importjava.awt.event.*;/***javadocdemo.java, an applet that displays Javadoc annotations *<p> Note that this is just an annotated version of Helloapplet *@seeJava.applet.Applet *@seeJavax.swing.Japplet*/  Public classJavadocdemoextendsapplet{/**Init () is an applet method that is initialized by a browser call * only once *@returnNo*/    Public voidinit () {//Create and add a button//and nothing else.Button B; b=NewButton ("Hello");        Add (b);   Show (); }   /**paint () is an AWT component method that is called when the component is to be drawn, and only * is a colored box in the Applet's window. * Parameter G one java.awt.Graphics * used in all drawing methods*/    Public voidPaint (Graphics g) {intW=getsize (). width,h=getsize (). Height;         G.setcolor (Color.yellow); G.fillrect (0,0,w/2, h);         G.setcolor (Color.green); G.fillrect (W/2,0, w,h);         G.setcolor (Color.Black); g.DrawString ("Welcome to Java", 50,50); }   /**Show () is used to make the component visible, and this method is not recommended for use in * JDK1.1 *@since1.0 *deprecated Swap with setvisible (true)*/    Public voidShow () {//because the show () is covered, this applet cannot display   }   /**applets must have a common parameterless construction method *@throwsjava.lang.IllegalArgumentException*/    PublicJavadocdemo () {if(NewJava.util.Date (). GetDay () ==0){            Throw NewIllegalArgumentException ("Never on a Sunday"); }   }}

JAVADOC common ways to use help documents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.