I have a class like the following...
class A{
/**
* Blah blah
*/
Type1 var;
/**
* What do I do here?
*/
Type2 var11, var12;
}
How can I javadoc var11, and var12 if they are both on the same line?
I am curious to see if this is possible, I know I can put them both on an individual line and javadoc from there.
Declaring each variable on a separate line is the preferred method. However, multiple variables on one line are acceptable when they are trivial temporary variables such as array indices.
Initialize Multiple String Variables With the Same Value in Java. In the below example 1, we declare the variables one , two , and three of the String type and then we initialize all the three variables with the same value. We are doing this by chained assignment.
@see is useful for information about related methods/classes in an API. It will produce a link to the referenced method/code on the documentation. Use it when there is related code that might help the user understand how to use the API.
To declare (create) a variable, you will specify the type, leave at least one space, then the name for the variable and end the line with a semicolon ( ; ). Java uses the keyword int for integer, double for a floating point number (a double precision number), and boolean for a Boolean value (true or false).
I was curious so I tried it out
/**
* data stuff
*/
int x , y ;
The resulting javadoc repeated the same doc comments for both x and y. I imagine this behavior would be useful if two fields were essentially the same with minor differences.
class Circle
{
....
/**
* center coordinates
* The x/y coordinate of the center of this circle.
*/
int x , y ;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With