Is there any free decent program to do code documentation for java?It's hard enough to get the coding project done and then need to spend time writing documentation as well.If you know, please tell me.
javadoc is the standard tool (included with the JDK) for Java source code documentation.
The standard Java API documentation has been generated with javadoc.
Well,
definitely there is javadoc. I think it is by far the most used tool for documenting java projects. Also, take into account that not only documents the methods and the classes but also you can document/create tutorials with static html pages and they'll appear in the generated documentation.
Javadoc (as noted) is the standard tool for Java. However you may want to check out Doxygen, which will provide more powerful code navigation features and rendering options.
Automatically generated documentation sucks. Why have it? it doesn't add any value.
All the most popular IDEs (Eclipse, NetBeans for example) would generate the javadocs for you. It would list all the parameter, thrown exceptions etc. For obvious-purpose methods like getters and setters it will also generate good enough comments (getX() "Gets x" etc.). What you'll need to do than is to complete the javadoc comments for the classes and methods that are more sophisticated than getters, setters or default constructors.
There is also plenty of plugins (for Eclipse see here) that you can use for example to generate UML diagrams to illustrate your code structure.
For years (more than a decade) I am using TallTree's DocJet (http://www.talltree.com/) to generate technical documentation from my Java/C++ code with very satisfactory results. The tool does not require any special tags (although it understands javadoc tags); it sufficient to describe class/method/field in plain English with occasional wording such as 'return' (or any other expression with the same meaning), "parameter" or "argument" and so on.