New to Javadoc

I have gone through the tutorial and am a bit confused on how to comment my program. I can comment my main method but am not sure what to do to comment the other mehods and my variables. Can anyone help me?
import java.util.StringTokenizer;
import java.util.regex.Matcher;
  * <p>
  * StringQuiz executes the 6 methods assigned in the document using methods
  * that are related to strings.
  * </p>
  * @author Daniel Wood
  * Date 2006.02.17
  * @version 1.0.0.x
  public class StringQuiz
       * @param args String array of command line parameters passed to main
     public static void main(String args[])
            * @return method_1 uses a regular expression to determine if the 5 address return the boolean
            * value of true or false.
          method_1();
          method_2();
          method_3();
          method_4();
          method_5();
          method_6();
     }//end main
     static void method_1()
     System.out.println("Method 1");
     String address1 = "112 Elm Street";
     String address2 = "112 South Elm St.";
     String address3 = "112 S. Elm";
     String address4 = "Elm St.";
     String address5 = "South 112 Elm";
     //"[\\d]+[\\s]+[a-zA-Z]+[ .]+[a-zA-z]+[ .]*[a-zA-z]*[ .\\n]?"
     String matchString = "\\d+ [A-Z,a-z,. ]+";
     System.out.println(address1.matches(matchString));
     System.out.println(address2.matches(matchString));
     System.out.println(address3.matches(matchString));
     System.out.println(address4.matches(matchString));
     System.out.println(address5.matches(matchString));     
     }//end method 1
     static void method_2()
        System.out.println("Method 2");
        String csv = ("23,  14, 19,21,    3");
        StringTokenizer tokens = new StringTokenizer(csv, ", ");
           while (tokens.hasMoreTokens() ){
           System.out.println (tokens.nextToken());
           }// end while
     }//end method_2
     static void method_3()
     System.out.println("Method 3"); 
     String hello = "Hello, How are you";
     hello = hello.replaceAll("H", "h");
     hello = hello.replaceAll(",", ".");
     System.out.println(hello);
     }// end method_3
    static void method_4()
   System.out.println("Method 4");
   String whale = "Willy the whale.";
   StringBuffer buffer = new StringBuffer();
   buffer.append(whale);
   buffer.insert (4, "fff");
   System.out.println (buffer.toString());
   }// end method_4
  static void method_5()
   System.out.println("Method 5"); 
   String num = "3.456";
   float number2 = Float.valueOf(num).floatValue();
   System.out.println(number2);
   System.out.println(number2 + 10);
  }// end method_5
   static void method_6()
   System.out.println("Method 6");
   String record = "This is record: 7Pq8";      
        System.out.println(record.substring(16, 20));
  }// end method_6
}// end  public class StringQuiz

Here is a simple example of how a method is documented. (This is a stupid method, but hopefully you get the idea.)
* Prints a String.  The length of the String is returned.
* @param  toPrint  the String to be printed
* @return   the length of the String
* @throws  NullPointerException if the String is null
public int printAString(String toPrint) {
   if (toPrint == null)
      throw new NullPointerException("Null string");
   System.out.println(toPrint);
   return toPrint.length();

Similar Messages

  • Online Chat, October 14, on What's New in Javadoc

    Javadoc is a tool for documenting software. For example, running the tool against a set of Java classes generates a series of HTML pages that lists the class names with each class's methods and fields. Version 1.4 the Java 2 SDK, Standard Edition added a number of changes to the Javadoc tool. These included several new tags and options, smarter inheritance of doc comments, and more control over HTML output. Learn more about these changes and get questions answered about the Javadoc tool in this chat with two key members of Sun's Javadoc team: Senior Staff Engineer, Scott Seligman, and Senior Technical Writer, Douglas Kramer. They'll answer your questions on Tuesday, October 14, at 11 A.M.-to-noon Pacific time (6 P.M.-to- 7 P.M. GMT).
    To join the chat on October 14, go to http://developer.java.sun.com/developer/community/chat/index.html anc click on "Join the current session."

    BTW, the chat starts at 11:00 A.M. PST (2:00 P.M. EST/19:00 UTC).

  • J2ee & javadoc (few questions)

    Hi everyone,
    I'm new to JavaDoc utility and I need some help from you. I wrote j2ee application which contains ejbs, servlets & other helper classes. Now I want to run the JavaDoc. I have few problems:
    1. When running the javaDoc utility I can't browse my classes by package. like the API of Sun:
    http://java.sun.com/j2se/1.4.2/docs/api/
    it is only possible to view all classes.
    2. when I run the javaDoc utility on the project root dir (recursive), I get documatation for Stub class (of the ejbs) & etc. Since there are too much ejbs, is there a way to remove these class from the output result?
    Thank you very much for your help...

    Use the -link option to link to other javadoc documentation:
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#link
    You can exclude packages using -exclude:
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#exclude
    If you want to just exclude particular classes, then you'll probably have to explicitly include all the classes you do want.

  • [ANN] XINS 2.1 open source Web Services framework release

    XINS 2.1 Web Services Framework has been released.
    XINS is an open source Web Services Framework based on simple specifications of the Web Service in XML and
    generation of code and documentation from the specification.
    The generation includes Client JAR with its Javadoc, Server side template with its Javadoc, documentation in OpenDocument Format,
    documentation in HTML including the test forms, WSDL file, unit tests (JUnit) and stubs.
    The Web Services accept several protocols including REST, SOAP, XML-RPC, XML, JSON Yahoo! and JSON-RPC.
    What's new:
    * Start the API with java -jar <api name>.war
    * Improved generated specification in OpenDocument Format
    * Include/exclude calling convention with ACLs
    * New calling convention that maps SOAP request and response as the wsdl2api command mapping.
    * Smaller generated build.xml
    * Added possibility to include other runtime properties files
    * The runtime property location can be a URL
    * Swing Graphical User Interface
    * New tools: emma, glean, webstart
    * New target: javadoc-test-<api name>, javadoc-apis
    * Bug fixes and small RFEs
    Download XINS 2.1:
    Windows installer: http://prdownloads.sf.net/xins/xins-2.1.exe?download
    TAR GZ archive: http://prdownloads.sf.net/xins/xins-2.1.tgz?download
    Resources:
    Web site: http://xins.sourceforge.net/
    XINS demos: http://xins.sourceforge.net/demo.html
    Documentation: http://xins.sourceforge.net/documentation.html
    User guide: http://xins.sourceforge.net/docs/index.html

    I recommend you implement your web service with JAX-WS 2.0
    Axis (both version) are good but why do you want to use something that is not included in JEE API, when Java provide same thing with better performance.
    personally try to prevent non standard technologies despite they can be better than core java implementation sometimes.
    I don't know Xfire.
    the good:
    -JAX-WS performance is better than axis,
    - you can create your web service simply with annotation.(this means write class and then make it as a service easily)
    - support every kind of service invocation(callback,Asynchronous,...)
    - architecture is nice (you can operate on SOAP level)
    the Bad:
    - It is JEE 5 or JSE 6 dependent.
    - there is seriously lack of documentation and examples for it, on java web sites and internet.

  • Full package name?

    All,
    I am very new to Javadoc. I would like to know how (if possible) to eliminate the full package name from any descriptions. For example, if I have a method that returns a Hashtable, the Javadoc that gets generated looks like this:
    public static java.util.Hashtable newMethod()
    I would like it to look like this:
    public static Hashtable newMethod()
    I'm using the Eclipse tool, and that is actually calling Javadoc and passing the appropriate parms (v1.4).
    I'm new to Javadoc, so I don't know if the generated method (with the package name) is preferred. I've also read some of the forum's comments on how to get started with this. I'm attempting to consolidate the lengthy Javadoc documentation, and some of the comments I've read have been helpful.
    Thanks,
    Van Williams

    The default should display the package name only
    for classes not in the "current" package.
    For 1.4, use "-noqualifier all" to prevent the package
    name from appearing ahead of the class name
    for all packages. This is further described at:
    http://java.sun.com/j2se/1.4/docs/tooldocs/windows/javadoc.html#noqualifier
    You can reduce the confusion this may cause
    by using -linkoffline to create links to
    classes not being documented, such as to
    java.util.HashTable in your example. This
    is further described at:
    http://java.sun.com/j2se/1.4/docs/tooldocs/windows/javadoc.html#linkoffline
    -Doug Kramer
    Javadoc team

  • Documenting command line arguments

    I'm very new to javadoc, and I'm trying to put together a set of guidelines for our developers to follow. One thing I came accross was command line arguments. If a main function is expecting command line arguments, how would this be documented, should @param be used? I didn't see anything about this in the guidelines sun has posted. Any help is greatly appreciated.

    This is my own personal opinion, so don't treat it as a "fact", but I don't think Javadoc is best suited for specifying command line arguments. You could do the following:
    *  Description of main() here...
    * @param args First parameter = xxx, Second parameter = yyy;
    public static void main(String[] args)
    }In this way you can specify all command-line parameters that are required in order to make the appliction run.
    BUT...
    Javadoc is meant more to be a programmatic guide to how to allow Java classes to interoperate. Java classes (mostly) will not care at all what the command-line parameters to the main invocation are. That is information that is only really needed to be known by the application executor at runtime.
    Therefore, for all my apps, I do the following to comment what types of parameters should be passed to the invocation of the application:
    * My App comments...
    * @param args Run application without any parameters to see list of all necessary command-line parameters.
    public static void main(String[] args)
       if (args.length < 1)
          System.out.println("This application allows the following parameters:");
          System.out.println("   Param#1 = xxx, <description>");
          System.out.println("   Param#2 = yyy, <description>");
          System.exit(0);
    }In this way, you do not clutter up the Javadoc APIs (used for classwise interaction) with command-line parameters, but the command-line parameters are still specified by "documentation" (running the application without any parameters).
    If parameters are optional, instead of mandatory, you could do something similar...
    * Documentation...
    * @param args Run -h as first flag for list of all optional parameters.
    public static void main(String[] args)
       if ((args.length > 0) && (args[0].equals("-h"))
          // Print out all possible parameters.
    }Anyway, this system has held me in good stead for the last couple of years.

  • How to omit package names?

    Hello all,
    I'm new to javadoc and trying to format my classes sames as the
    sdk doc. The problem is that in the sdk doc on top of the page
    the tree shows the classes with package names, and in the
    parameter lists etc. the package names, e.g. for "String",
    are not shown. How can I do this? I want to get exactly the
    same documentation format as the sdk doc.
    With -noqualifier I can not do what I want. I only can get all
    classes full qualified or no class at all.
    Thanks in advance.
    bye
    Marcus

    We have also addressed this problem in DocFlextor for Javadoc v1.1
    by introducing two new template parameters:
    (1) Omit package qualifiers started with
    (2) Omit all package qualifiers
    You may use freeware DocFlextor Doclet:
    http://www.filigris.com/downloads/
    or look at the whole thing:
    http://www.filigris.com/products/docflextor_for_javadoc/
    -- Leonid Rudy

  • Newbie to Java Doc

    Hello All,
    I am pretty new to JavaDoc - i got a general hang of it and did some sample java doc generations for some java files to understand more better. Now I have been requested to create custom javadoc tags for an existing project. How do I go about this? It would be appreciated if anyone could help me out with pointers .
    Thanks

    Depending on how complex the produced output of your custom tags should be you can either use Javadoc's -tag option or write a custom Taglet.
    See [http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#tag] and [http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/taglet/overview.html] for related documentation.

  • Strange indexing behavior

    Hi, I'm using a pretty standard setup for javadoc: version 1.5.0, standard doclet, Eclipse IDE, and use the -private option. Although all inner classes are documented, some of them are missing in index files:
    public class Lotto {
         private static enum Lotto.Cmd {} //shows up correctly
         private final class Lotto.ActionLoad implements ActionListener {}
              //only seen in "Nested Class Summary" of Lotto.html,
              //missing in allclasses-frame.html
    }Since I am new to javadoc, I wouldn't even know where to look for a reason for this behavior. Can someone help?
    Btw, I expect that inheriting documentation texts from standard libraries like javax.swing would only work with the sources present?

    Hi, I'm using a pretty standard setup for javadoc: version 1.5.0, standard doclet, Eclipse IDE, and use the -private option. Although all inner classes are documented, some of them are missing in index files:
    public class Lotto {
         private static enum Lotto.Cmd {} //shows up correctly
         private final class Lotto.ActionLoad implements ActionListener {}
              //only seen in "Nested Class Summary" of Lotto.html,
              //missing in allclasses-frame.html
    }Since I am new to javadoc, I wouldn't even know where to look for a reason for this behavior. Can someone help?
    Btw, I expect that inheriting documentation texts from standard libraries like javax.swing would only work with the sources present?

  • Ignoring ejbdoclet tags

    I'm a little new to javadoc so forgive me if this is stupid.
    We have custom tags in our code that we get ejbdoclet to use to generate out deployment descriptors. One example of that would be:
    @ejb:transaction type="Supported"
    When I run javadoc it warns me that it doesn't know about this tag. I have tried all manner of variations of the -tag option but they don't work.
    It does work for custom tags that don't have the form @a:b. For example if I have a custom tag of @ejb param="value" and specify
    javadoc -tag ejb:X:"ejb stuff" then everything is fine. As soon as I have a custom tag of @ejb:transaction param="value" it does not work.
    I have tried
    javadoc -tag ejb:X:"ejb stuff" ...
    javadoc -tag ejb:transaction:X:"ejb stuff" ...
    javadoc -tag "ejb:transaction":X:"ejb stuff" ...
    javadoc -tag 'ejb:transaction':X:"ejb stuff" ...
    Can anyone tell me how to get around this?
    Thanks, Andrew
    PS: As an aside in my example that works, javadoc -tag ejb:X does not work, even though the documentation says it should. I have to add the header...

    Hi,
    Yes, it is a bug that the doclet does not support custom tags with "-" characters in the name properly. The only workaround is to write your own taglet. This should work:
    import com.sun.tools.doclets.standard.tags.SimpleTaglet;
    public class Foo extends SimpleTaglet {
    public Foo() {
    super("ejb.create-method", null, "x");
    When you run javadoc, use:
    -taglet <qualified name of your taglet> -tagletpath <path to your taglet>
    That's a lot of work just to ignore one tag, but this is a workaround for a bug that will probably be fixed soon.
    -Jamie

  • Generated Documentation (Untitled)

    I'm new to javadoc and I think it's a great tool, in general.
    You probably know this title: Generated Documentation (Untitled)
    It's set in index.html by default. Searching for it shows: billions of developers publish it on the web as is...
    How can I modify it most easily?
    I use the Eclipse IDE and find no option for it ?
    I ran javadoc -help, and I think the option
    -windowtitle <text>               Browser window title for the documenationis used already, but applies to the indiviual pages, visible in the NO FRAMES mode.
    Currently, I copy index.html to index.htm and edit the desired title there, to avoid getting it overwritten every time I rerun javadoc, which happens very often, currently.
    Yes, it's a minor issue, but I think, I can solve the other ones myself, currently. ( or come back here again ;)
    Thanks for feedback

    add
    -windowtitle "Your Title Goes Here"to the Extra Javadoc options on the last "Generate Javadoc" wizard page of Eclipse, and see how this text is merged with other text ...
    Thanks folks, for giving me the time to experiment myself ;)

  • DB table look up

    can we configure a db table (not as a resource) but as a reference table to auto fill a form depending on the value of one of the form field .
    my env: Sun idm 6.0, sun LDAP 5.2, mysql 4.1 repo, tomcat 5.0.28
    Thanks In Adv
    Nsankar

    The JavaDocs are easy to use even when I was a newbie to both SIM and Java (actually, I am still a newbie to Java). In the XML display of your rule/form in the BPE, right click and go to New->Browse JavaDoc. From there you can view the JavaDoc to find the right function to call, then when you click 'select' it puts the template for a call to the selected function into your Xpress code.
    I will see if I can find an example of how to call the JDBC functions exposed in SIM and post it here.

  • JavaDoc documentation for new BC4J UI classes

    Hi All
    I could not find JavaDoc documentation for new UI packages (
    oracle.jbo.uicli.*** ) in JDeveloper 9i RC. Does anybody have an
    idea where can I find them?
    Regards,
    Shota

    The Javadoc for the Release Candidate is not accessible directly from the help system. You can, however, open the javadoc by using the
    "Browse Javadoc" command in the Code Editor: 1. Highlight the symbol in the Code Editor (for instance, type "JUApplication" anywhere in a
    .java file that you open in the Code Editor), 2. Right click and choose "Browse Javadoc". JDev will open the javadoc for the highlighted symbol
    and you can use the Prev link to traverse the tree until you find the desired package. In the Production release, the Javadoc will be
    accessible directly from the HelpViewer Contents pane (and thus allow searches on the Javadoc). FYI: All Javadoc appears in the /jdev/doc/ohj/
    folder in your installation.

  • How do I get javadoc to open in a new window?

    Hi,
    How can I get javadoc to open in a new window rather than a tab in JDeveloper?
    Thanks,
    Will
    Message was edited by:
    decuser

    Right click the FireFox button in your toolbar and look in the properties- middle tab...make sure that it only has "C:\Program Files\Mozilla Firefox\firefox.exe" with no other link added to the end. I had a similar problem this morning and found a website had attached it's link to the end so it would always pop up first and would only open a new tab.
    Hope that fixed it.

  • [svn] 1549: New Javadoc package-info file.

    Revision: 1549
    Author: [email protected]
    Date: 2008-05-03 03:53:04 -0700 (Sat, 03 May 2008)
    Log Message:
    New Javadoc package-info file.
    Added Paths:
    blazeds/branches/3.0.x/modules/proxy/src/java/flex/messaging/services/http/package-info.j ava

    Revision: 1549
    Author: [email protected]
    Date: 2008-05-03 03:53:04 -0700 (Sat, 03 May 2008)
    Log Message:
    New Javadoc package-info file.
    Added Paths:
    blazeds/branches/3.0.x/modules/proxy/src/java/flex/messaging/services/http/package-info.j ava

Maybe you are looking for

  • Windows 7 (64bit) Missing programs in uninstall a program list.

    Hi, My grandson likes to play internet games and downloads quite a number of them from time to time, and as usual, it leaves me uninstalling quite a lot of add-ons and other types of unwanted files. Toolbars, vius protections, etc. You name it...and

  • ? What can i do about this, i will have cancel this if i can not use the programs

    good evening i have just purchased lightroom and photoshop on a 12 months contract and its now saying i am running a operative system that photoshop no longer supports  ? What can i do about this, i will have cancel this if i can not use the programs

  • Unable to import MPG-files in CS4

    Hi I'm using a trial version of Premiere Pro CS4, but I have some troubles with importing some MPG-files. When I try to import them PP tells me that the file is not supported or dammaged. But they work fine in media players and Windows Movie Maker. I

  • XML output of a form after submission?

    Hi, Iv'e been tasked with creating a form rendered in HTML format, filled out, submitted with the results (a single XML file or String) written to a named database/table/field. When the submit button is pressed, I need to somehow capture the output o

  • "Spoofed" Email Address

    While typing my name when I BCC'd an email to myself, all the email addresses I have ever associated to my name appeared in a dropdown. However, another email address masquerading as my .Mac address also showed - [email protected] My .Mac address was