Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javadoc multiple variables on single line

Tags:

java

javadoc

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.

like image 282
Jimmy Huch Avatar asked Mar 11 '12 20:03

Jimmy Huch


People also ask

Can I declare multiple variables in single line in Java?

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.

How do you initialize two variables at the same time in Java?

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.

What does @SEE mean in Javadoc?

@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.

How do you declare two integers in Java?

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).


1 Answers

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 ;
like image 105
emory Avatar answered Oct 08 '22 17:10

emory