How should I document the parameter of the following method?
public static void main (String[] args) throws IOException
Should I use @param
?
How should I document the parameter of the following method?
public static void main (String[] args) throws IOException
Should I use @param
?
Using JavaDoc...
/**
* Our main method. Some kind of handy description goes here.
* @param args The command line arguments.
* @throws java.io.IOException when we can't read a file or something like that.
**/
public static void main(String[] args) throws IOException {
...
}
Here is a document on how JavaDoc comments work.
Use javadoc, but in the case of arrays (including varargs), I prefer to describe each element's meaning, eg
/**
* Copies a file
* @param args[0] The source file path
* @param args[1] The target file path
* @throws IOException if an error occurs
**/
public static void main(String[] args) throws IOException {
//
}
Although this is not "officially sanctioned" (AFAIK), it is much clearer.
If this is a "main" method, documenting the exception is a bit pointless, as nothing will catch it.