How can I add java docs to my java program using netbeans?
3 Answers
You have a number of options:
- Right-click on a source package and select Tools > Analyse Javadoc. This will add Javadoc to all methods
- Type /** on the line before a class, method or field declaration, and then press Enter. Default Javadoc will be created for that method
- Place the cursor within a class or method declaration. Press Alt + Enter, and then select "Create Javadoc"
5 Comments
vkraemer
This applies to NetBeans 6.8, right? Does it apply to earlier versions?
Daniel
I've tried the first and third options on earlier versions of Netbeans than 6.8. I'm fairly sure they work on 6.5. Not so sure about the second one: I've only tried that on 6.8.
Devon_C_Miller
The first form has been there for quite a while (3 or 4 I think). However in pre-6 release it's available by right-clicking on the class in the projects window and was called something like "Autocorrect Javadoc". The second form has been there since 4 or 5. The third form was introduced in NB6.
partho
In every javadoc theres some link of another java doc, How do I make a link?
Rafs
ALT + ENTER in macOS would be? Option + Return is not doing it
Also, use the
@param
tag to specify parameters in a Javadoc:
/**
*
* A method
*
* @param abc Used to do nothing
*/
public static void doNothing(int abc) {
System.out.println(abc);
}
You can also use the Alt+Enter combination in Netbeans to automatically insert the Javadoc with all parameters, however remember that this method/field can't be private.
/**and come in front of classes and methods. You just type them. What more do you want? What are you asking?